Global Mapper v25.0

Exporting Vectors as Shapefile script problem

dawright
dawright Global Mapper User
edited April 2012 in GM Script Language
Hi

I am using V11.02 and trying to automate (using scipting for the first time - see below) to export individual contours lines to separate shapefiles by splitting on "feature name". Feature name is the name of each individual contour elevation level of 48 levels (ie 1010 m). I generated the contours from a DEM in GM, saved as a shapefile and opened the contours shapefiile in GM as a new layer (the only layer).

I used the example in the forum http://www.globalmapperforum.com/forums/technical-support/5240-scripting-sdk-select-entities-based-attribute-value-export-subset-file.html

When I run the script I am getting an error "Vector data must be loaded for EXPORT_VECTOR command" but the shapefile is already loaded.

I note this link has a differnent build to fix the problem - is this my problem or am I doing something else wrong>

Any help would be appreciated.

Thanks

David



Script File
GLOBAL_MAPPER_SCRIPT VERSION=1.00
// Export vector as shapefile
EXPORT_VECTOR FILENAME="C:\temp\Test\Contours.shp " \
TYPE=SHAPEFILE \
SHAPE_TYPE=LINES \
GEN_PRJ_FILE=YES \
SPLIT_BY_ATTR=YES \
FILENAME_ATTR_LIST="<Feature Name>" \
FILENAME_INCLUDE_ATTR_NAME=YES

Script Results

Exporting vector data to file C:\temp\Test\Contours.shp ...
ERROR: Vector data must be loaded for EXPORT_VECTOR command.
Script processing COMPLETED.

Comments

  • global_mapper
    global_mapper Administrator
    edited April 2012
    Your script isn't loading any data itself, so for this to work you would need line data loaded in the main map view AND you must check the box to run the script in the context of the main map view on the Run Script dialog. If that is not checked then only data loaded in the script itself would be available, which is nothing in this case.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dawright
    dawright Global Mapper User
    edited April 2012
    Hi Mike,

    Thanks for your prompt reply.

    I simply checked the checkbox (which I had not previously noticed) and the script worked straight away as was.

    Its always somethig simple and usually "operator error":).

    Cheers

    David