Automate/Create over 500 shapefile
teddy
Global Mapper UserTrusted User
Hello,
I have a map of a country (shapefile) with over 500 counties. The thing is I need to create a shapefile for each county and was wondering if there was an automated method of creating the shapefile from the country map. As you can imagine, this will save me from creating 500 shapefiles. thanks
I have a map of a country (shapefile) with over 500 counties. The thing is I need to create a shapefile for each county and was wondering if there was an automated method of creating the shapefile from the country map. As you can imagine, this will save me from creating 500 shapefiles. thanks
Comments
-
If each county has a unique attribute (like county name), you can do this by writing a simple script to export the shapefile split based on that. Here is an example script to do this (run using the File->Run Script command):
GLOBAL_MAPPER_SCRIPT VERSION=1.00
EXPORT_VECTOR FILENAME="c:\path_to_export\new_shapefile_name.shp" \
TYPE=SHAPEFILE SHAPE_TYPE=AREAS SPLIT_BY_ATTR=YES \
FILENAME_ATTR="<Feature Name>" FILENAME_INCLUDE_ATTR_NAME=NO
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Not sure what I am doing wrong. I click on run script and I get a dialog box and I assume I have to load my .gmw file with all the counties in one map. Yes I have a feature name "W_Name" so I saved the following as a txt and loaded after the gmw was loaded and the result is below. What do I need to change to make it work?
GLOBAL_MAPPER_SCRIPT VERSION=1.00
EXPORT_VECTOR FILENAME="c:\users\d1\Documents\AK\GIS\Data\shapefiles\new.shp " \
TYPE=SHAPEFILE SHAPE_TYPE=AREAS SPLIT_BY_ATTR=YES \
FILENAME_ATTR="<W_Name>" FILENAME_INCLUDE_ATTR_NAME=NO
Script Results
WARNING: Unknown parameter <SPLIT_BY_ATTR> ignored.
WARNING: Unknown parameter <FILENAME_ATTR> ignored.
WARNING: Unknown parameter <FILENAME_INCLUDE_ATTR_NAME> ignored.
Exporting vector data to file c:\users\d1\Documents\AK\GIS\Data\shapefiles\new.shp ...
ERROR: Vector data must be loaded for EXPORT_VECTOR command.
Script processing COMPLETED. -
First of all, what version of Global Mapper are you using? The SPLIT_BY_ATTR and related parameters are pretty recent additions, so unless you are on the latest release (v11.02) those options won't be available.
Once you are on the latest release, to split on a normal attribute (rather than the special <Feature Name> attribute), don't enclose the attribute name in greater than and less than signs. Instead just use FILENAME_ATTR="W_Name".
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com
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