Export Vector Dataset to Shape File with changing data type
I script exporting vector datasets to shape file. Before the data records are exported, the data typ of one attribute has to be converted from numeric to string.
How can I implement this?
Regards,
Daniel
Answers
-
Hi Daniel,
In the Shapefile Export Options, on the Attribute Setup tab, you should be able to find the attribute in the list. You can change the attribute associated type by clicking on its entry in the Type field. Hope that this helps.
Cheers,
~Jeff
-
Hi Jeff,
I know the way via Shapefile Export Options and changing the associated attribute type. Exactly these settings/options I'm looking for in global mapper script.
cheers,
Daniel
-
Hi Daniel,
Sorry, I missed the bit about scripting.
So I looked at the script engine and as far as I can tell, the shapefile export command doesn't support changing attribute types directly. That would be a nice addition, so I've added a new ticket, GM-13876, to add that functionality.
A possible workaround is to use the CALC_ATTR_FORMULA script command, using the STR() function in a formula to create a new attribute of the desired type. See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/cmd/CALC_ATTR_FORMULA.htm for CALC_ATTR_FORMULA, and the associated script formula reference https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/Scripting_Reference/Formula_Calculator.htm.
If you need to use the same attribute name for the export, you can use the EDIT_VECTOR script command with the ATTR_TO_RENAME parameter to rename the original attribute in question to something else, and then use CALC_ATTR_FORMULA to create a new attribute with the original name. See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/cmd/EDIT_VECTOR.htm
Best regards,
~Jeff
-
Hi Jeff,
I'm glad that you opened a ticket for the missing possibility. Until then I will try your workaround.
best regards,
Daniel
-
If you have problems with the workaround, feel free to give a shout, but I'm pretty sure it will work; it's just more complicated, and changes the original data. Best, ~Jeff
Categories
- 12.4K All Categories
- 5.4K Features Discussion
- 314 Downloading Imagery
- 1.3K Elevation Data
- 377 Georeferencing Imagery Discussion
- 603 GM Script Language
- 49 User Scripts
- 112 GPS Features
- 394 Projection Questions
- 800 Raster Data
- 1.3K Vector Data
- 6.5K Support
- 161 Announcement and News
- 890 Bug Report
- 556 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 537 Other Discussion
- 128 GIS Data Sources
- 26 Global Mapper Showcase
- 224 How I use Global Mapper
- 104 Global Mapper Forum Website