Global Mapper Pro Coming Soon

How to export area shapefiles that are within a shapefile?

NateNate Global Mapper UserPosts: 9
edited August 2009 in Vector Data
I am using Global Mapper 10.02. I have a bunch of area shapefiles contained within a single container shapefile.

How would I go about exporting each area shapefile into it's own file? There are enough of these area shapefiles that it needs to be automated/batched.

Thanks

~Nate

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2009
    Nate,

    So you want to export each area feature into its own file? There's not really an easy way to do that. You can export new Shapefiles split by a feature type/description, but all of your features would likely have the same type to start. I'm not sure there's a good way to do this other than using the Global Mapper SDK to manually do something.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • NateNate Global Mapper User Posts: 9
    edited August 2009
    Thanks for the quick response, how do we go about getting a copy of the SDK?
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2009
    You get that from the Developers page at GIS Mapping Software - GPS Mapping Software - Satellite Maps - Aerial Photos [Global Mapper]. For what you are doing you would want to do the following steps:

    1) Load Shapefile with GM_LoadLayerList
    2) Call GM_GetLayerInfo to get layer info with area count (mNumAreas) from Shapefile
    3) Iterate from 0 to mNumAreas and call GM_GetAreaFeature for each area
    4) Create a new custom vector layer with GM_CreateCustomVectorLayer
    5) Add the area from step 3 as a new area to the custom layer from #4 (GM_AddAreaToVectorLayer)
    6) Use GM_ExportVector to export your custom vector layer (which has just your one area) to a new Shapefile
    7) Close the custom vector layer from #4 with GM_CloseLayer
    8) Go to step 3 and repeat for the next area
    9) Close the original Shapefile layer with GM_CloseLayer

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • NateNate Global Mapper User Posts: 9
    edited August 2009
    Awesome, thanks. I don't suppose you guys would have a complete C# wrapper laying around?
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2009
    There is a simple C# sample application included with the SDK, but not a complete wrapper. If you are just doing this one task and you are at all comfortable with C++ I would instead suggest just starting with the existing C++ sample application and adding your simple function there rather than doing all the hard work of marshalling and stuff required in C#.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • NateNate Global Mapper User Posts: 9
    edited August 2009
    That was my backup plan. I appreciate all the help.
Sign In or Register to comment.