Easy script for changing line style.
Hello,
This my first post in the forum, I’m searching some help for my first and very easy script that I cannot find the way to do it.
My idea is to convert many shapefiles to kml, for that I created a loop like this:
GLOBAL_MAPPER_SCRIPT VERSION="1.00"
DIR_LOOP_START DIRECTORY=D:\GLOBAL_MAPPER_INPUT\ FILENAME_MASKS="*.shp"
IMPORT FILENAME="%FNAME_W_DIR%"
EXPORT_VECTOR
FILENAME="D:\GLOBAL_MAPPER_OUTPUT\%FNAME_WO_EXT%.kml" TYPE=KML
UNLOAD_ALL
DIR_LOOP_END
But I would like to change also the line style and the color for every file. I have tried with DEFINE_LAYER_STYLE but it doesn’t work. Anyone could help me on that?
Thank you very much.
Cheers.
Answers
-
I'd try adding
GLOBAL_MAPPER_SCRIPT VERSION=1.00
Then you can set up an attribute value to style off and Global Mapper will find it in the COMPARE_STR command
DIR_LOOP_START DIRECTORY=D:\GLOBAL_MAPPER_INPUT\ FILENAME_MASKS="*.shp"
IMPORT FILENAME="%FNAME_W_DIR%"
EDIT_VECTOR STYLE_ATTR="LINE_STYLE=SOLID" STYLE_ATTR="LINE_WIDTH=3" STYLE_ATTR="LINE_COLOR=RGB(0,255,0) COMPARE_STR="attribute_value=something"
EXPORT_VECTOR FILENAME="D:\GLOBAL_MAPPER_OUTPUT\%FNAME_WO_EXT%.kml" TYPE=KML
DIR_LOOP_END
UNLOAD_ALL
There is a list of supported styles you can script with here
-
Hi MorganRS,
Thank you very much for your help.
I copy the exact code you wrote and make the job.
I didn’t catch the last thing you told me about seting up and attribute value to style off Global Mapper, I believe I am to noob in scripting to do that…
Thank you again.
Cheers.
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