With an investment in MapInfo Pro Advanced, I thought I delve into the types of raster analysis I could do with the MRR format in my own software. One thing that was a bit a disappointment was to see that there doesn’t seem to be any MapBasic support (in the form of new statements or functions) for Advanced rasters. In my Pro installation folder, I found a Raster\Documentation folder and a Windows help CHM file with some documentation on the API. I presume/hope it’s possible to create MapBasic declare statements to call these functions.
My immediate interest is how I can perform polygon-over-raster analysis… extracting min/max/avg/sum (or some other function that distils an aggregate) for cells that fall (partly/wholly… ideally I get to choose) inside region objects held in MapBasic variables. I found a function called GetPolygonStatistics in the API documentation but this only seems to enrich a whole table by adding a new field and populating in one operation. I was looking for something for single region operations under my own MapBasic program control. Is that possible?
Anyone had any success with writing their own code to utilise MapInfo Pro Advanced’s raster capabilities? I’m wonder if this powerful functionality is not being fully utilised because it’s not been made very accessible?
Regards,
Warren Vick
I have worked a bit with the MapInfo Pro Raster API. As you have learned yourself it's a .NET API. Sofar we haven't created declarations for the API to be used from MapBasic.
That could very well be done. I'm not sure if we have that on our product backlog. You would probably loose a bit of the power of the API if you called the method directly from MapBasic. I'm not sure we would support things like processing threads running in the background for example.
You can find a sample application of mine showing how you could take advantage of the MapInfo Pro Raster API by calling custom .NET methods from MapBasic on github. The tool is called mbMapInfoRasterTool: https://github.com/PeterHorsbollMoller/mbMapInfoRasterTool
One of the sample does show how to use the Regions Stats. I'd think you woul dhave to save your polygon to a new temporary table, run it thru the Region Stats process and then read the values from the added columns.
Also answered on Li360:
Peter Horsbøll Møller
Pitney Bowes
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks, Peter. I'll take a look at your mbMapInfoRasterTool. Further comments posted to LI360.
/Warren
Hi Jose
First of all, you need this .NET method to export your grid into a MapInfo vector table:
public static void ExportToTab(
string inputFilePath,
string outputTabFilePath,
RasterExportToTabOptions ExportToTabOptions = null,
RasterApiOptions apiOptions = null,
IRasterProgressTracker progressTracker = null
)
Secondly, you have to set the RasterExportToTabOptions in the right way.
Consider setting this to true:
If OutputAsRectangles is set to true, writes rectangle objects in the output TAB file else writes point objects. The size of rectangle would be same as the source raster's cells. If ColorFromSource is true, the rectangles will have a solid fill with no border line and the fill color will match the source raster. If ColorFromSource is false, then the rectangles will have no fill (hollow) and have a simple black border line. |
But there might be other settings too.
This does however require a bit of .NET development
Do let me know if I got your question wrong as there are multiple ways to convert a raster to vector
Peter Horsbøll Møller
Pitney Bowes
To unsubscribe from this group and stop receiving emails from it, send an email to mapi...@googlegroups.com.