Exporting Vectors as Shapefile script problem
dawright
Global Mapper User
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.
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
-
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 -
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
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