Global Mapper Pro Coming Soon

Automate/Create over 500 shapefile

teddyteddy Global Mapper UserPosts: 18Trusted User
edited May 2010 in Technical Support
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

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    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
  • teddyteddy Global Mapper User Posts: 18Trusted User
    edited May 2010
    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.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    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
Sign In or Register to comment.