UK Users Group

 View Only
  • 1.  Using Python to access and run Raster Operations

    Posted 01-13-2022 04:17
    Edited by Luke Lynx 01-13-2022 04:17
    Hi,

    I am wanting to use python commands to assess the raster operations (specifically "RasterAnalysis.Polygonise") I have an input raster and also a levels file which I want to use for the polygonisation method, however, I am unable to figure out how to call and write the function, I currently have the following:


    import clr
    import os
    clr.AddReference("MapInfo.RasterEngine.IO")
    clr.AddReference("MapInfo.RasterEngine.Common")
    clr.AddReference("MapInfo.RasterEngine.Operations")
    from MapInfo.RasterEngine.Operations import RasterAnalysis
    from MapInfo.RasterEngine.Common import PolygoniseParameters

    input = "Raster_FilePath.asc"
    output = "RasterPolygonise_FilePath.TAB"
    levels = "Intervals_FilePath.level"

    RasterAnalysis.Polygonise(input,output,PolygoniseParameters((levels)))

    Any help would be much appreciated.
    Thanks

    ------------------------------
    Luke Lynx
    Knowledge Community Shared Account
    ------------------------------


  • 2.  RE: Using Python to access and run Raster Operations

    Employee
    Posted 01-13-2022 07:56
    Luke,

    I wonder if the example provided in this post in the MapInfo Pro Developer User Group could be of help to you.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------