How to export area shapefiles that are within a shapefile?
Nate
Global Mapper User
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
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
-
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 -
Thanks for the quick response, how do we go about getting a copy of the SDK?
-
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 -
Awesome, thanks. I don't suppose you guys would have a complete C# wrapper laying around?
-
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 -
That was my backup plan. I appreciate all the help.
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website