Global Mapper Pro Coming Soon

Global Mapper SDK for automation

bcastellobcastello Global Mapper UserPosts: 40
edited January 2009 in SDK
I'd like to create an app that will watch a folder location for new shape files, which will then open them and assign an area type according to attributes in one of the fields of the the associated .dbf file... then export the result to a .BIL file.

Will the SDK support this?

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2008
    Yes you could do this with the SDK. In your portion of the app you would do the watching for new files, then when new ones show up you could load them with the SDK, then spin through the features loaded and classify based on the results of whatever field that you are interested in.

    The one strange part is exporting to .BIL. Are you simply wanting to rasterize the rendered Shapefiles and export them to a BIL file? If so that is fine.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • bcastellobcastello Global Mapper User Posts: 40
    edited December 2008
    Mike,

    As always, thank you for your quick response. Yes, I'm interested in rasterizing the shapefiles to BIL format, but using the area types defined in GM to colorize the attributes in the DBF table.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2008
    Let me know when you need this as the BIL raster export is not in the SDK yet but could easily be added very quickly.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • bcastellobcastello Global Mapper User Posts: 40
    edited December 2008
    It's possible we may be able to connect the SDK to another format directly and avoid needing the BIL as an intermediate step. I'll do some more checking and let you know.
  • bcastellobcastello Global Mapper User Posts: 40
    edited January 2009
    We are about ready to make a purchase of the SDK. You mentioned it would not be too difficult to add an additional format (BIL) to the list of formats that the SDK can produce.

    Is there any other info you need from us before you can incorporate it?

    Thanks Mike!
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    I don't need anything else from you. I'll go ahead and add that format and let you know when it is ready.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    I have completed adding support for exporting data to raster BIL files to the SDK. There is a new GM_Export_BIL_Raster format option for use with the GM_ExportRaster function. I have placed a new build of the SDK with this support at http://www.globalmapper.com/GlobalMapperSDK_v130_beta.zip.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • bcastellobcastello Global Mapper User Posts: 40
    edited January 2009
    We compiled the sample application included with the SDK, which was successful after copying a DLL into a different directory than that in which it arrived. Trying to run the resulting exe gives a DLL error that could probably be solved by setting the Windows equivalent of the LD_LIBRARY_PATH env var in Unix… the program complains about various DLLs being missing whereas they are in the bin directory within the SDK folder.

    I thought maybe the program would indicate what functionality was available in the SDK version I got.

    Anyway we can get a full evaluation version for a few weeks to do the programming and testing before we purchase?
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    The sample application doesn't have all of the DLLs needed in its build folders as I didn't want to increase the size of the download for files that are already there. You just need to copy the contents of the Bin folder to the Debug and Release folders for the sample application for it to run.

    If you send me an email directly to support@globalmapper.com I can provide you with a trial key to try the full functionality of the SDK.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • LeighLeigh Global Mapper User Posts: 4
    edited January 2009
    I am the developer that Bill has been talking about in his previous posts. I have been able to use the SDK to export the BIL files but there is a display problem with the ones that I created versus the ones that Bill created in Global Mapper. I am just setting GM_ExportFlags_Grayscale flag and letting it automate the conversion but it seems that Bill is creating a custom color table and using that to set the values for the color fill of the polygons. Is there a way to set up a custom table and use it with the SDK?

    Thanks
    Leigh
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    You can set the colors of any polygon data prior to export using the GM_SetAreaFeatureDrawStyle function. Of course if you pass the GM_ExportFlags_Grayscale flag to the export any colors will be converted to grayscale. If you want to maintain the colors don't pass that flag so you can create a full-color RGB BIL file.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • LeighLeigh Global Mapper User Posts: 4
    edited January 2009
    I looked at GM_SetAreaFeatureDrawStyle function in the reference document and found this:

    Sets the style and font to use for drawing the given area object. Pass NULL for the area style to reset the drawing style to the default style for the classification of the area.

    Typically, when modifying the drawing style of an area you'll want to call GM_GetAreaFeature to get the current drawing style, then copy the mAreaStyle member of the GM_AreaFeature_t and just change what you need, then pass your copy in to this function.

    When I starting looking at GM_GetAreaFeature function it needs the layer and the index. Is there a way to find out how many indexes are in the layer using the sdk so that they all can be passed to the function to get and set the features?

    Thanks
    Leigh
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    Leigh,

    Yes, simply call GM_GetLayerInfo to get information about the layer, including the mNumAreas value which will be the number of areas in the layer. You can then iterator through area indices 0 to mNumAreas to go through all of the area features in a layer.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • bcastellobcastello Global Mapper User Posts: 40
    edited January 2009
    After Leigh put together an application to process the shape file, she has not yet been able to get her routine to access the fill properties for each polygon in the shape. Only the default outline is showing up so far.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    How is she changing the fill style? She needs to remember to change the mBrushStyle member of the GM_AreaStyle_t structure to GM_BRUSH_SOLID and set the mBrushColor to whatever color that is desired.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • LeighLeigh Global Mapper User Posts: 4
    edited January 2009
    Thanks for the heads up. I set the mbrushcolor but not mbrushstyle.

    Leigh
  • LeighLeigh Global Mapper User Posts: 4
    edited January 2009
    One more question for you. How do I turn off the borders in the area so that the are shows up solid filled with no borders(lines) in it?
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2009
    Set the mBorderPenStyle to GM_PEN_NULL.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
Sign In or Register to comment.