Prompt for select a layer
Hi,
Is it possible to prompt the user for select a user defined layer.
I mean :
hide all layer (layer loop should be ok ),
retrieve layer names (or not possible ?)
prompt user for a layer_name (define variable) ,
unhide only the provided layer_name layer ?
I am just discovering GM scripting... Great but not always easy ...
Thanks in advance for replies.
Is it possible to prompt the user for select a user defined layer.
I mean :
hide all layer (layer loop should be ok ),
retrieve layer names (or not possible ?)
prompt user for a layer_name (define variable) ,
unhide only the provided layer_name layer ?
I am just discovering GM scripting... Great but not always easy ...
Thanks in advance for replies.
Answers
-
Hello,
Global Mapper scripting does not have a function to prompt the user to choose one of the currently loaded layers. You can prompt the user to type in a string and match it against one of the layer variables that is available within the layer loop.
Another option is to prompt the user for a file name, and then import the selected file, but that is not the same thing, of course.
Cheers,
Bob -
Here is an example:
// Prompt for file name without extension
DEFINE_VAR NAME="LAYER_TO_USE" PROMPT=YES ABORT_ON_CANCEL=YES \ PROMPT_TEXT="Type the name of a layer:"
// Loop over the loaded layers, do something for the selected layer
LAYER_LOOP_START FILENAME="*"
IF COMPARE_STR="%LAYER_FNAME_WO_EXT%=%LAYER_TO_USE%"
// Do something...
END_IF
LAYER_LOOP_ENDCheers,
Bob -
Many many thanks
Categories
- 12.6K All Categories
- 5.5K Features Discussion
- 337 Downloading Imagery
- 1.3K Elevation Data
- 379 Georeferencing Imagery Discussion
- 620 GM Script Language
- 52 User Scripts
- 113 GPS Features
- 405 Projection Questions
- 815 Raster Data
- 1.3K Vector Data
- 6.5K Support
- 171 Announcement and News
- 897 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 559 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 231 How I use Global Mapper
- 106 Global Mapper Forum Website