Global Mapper Pro

Adding KML_FOLDER attribute to a 100 hundred layers or so...

Steve D
Steve D Global Mapper UserTrusted User
edited December 2011 in GM Script Language
Problem:
I have a *pile* of viewsheds, each with a bajillion islands (particularly the older ones, created using Pathloss)
Obviously, a bazillion features in KML's are useless. All my data was originally created with it being used for a tile server (display on google maps) in mind, but trying to be fancy for the company intranet and have the ability to turn on and off individual viewsheds, as many are overlapping. Right now, coworkers will call me, I'll fire up GM and have a look for them. Would prefer they have a KML in Google Earth, or maybe in Google Maps... but for the time being I need to overcome one major flaw: none of the features have a KML_FOLDER, and the viewsheds generated by GM don't (seem to?) even put the layer name into the features.

Goal:
I would like to come up with a script that adds the KML_FOLDER to all of the features, with value set to the name (or description, if that's more accurate) of the layer.

Progress:
How do I A) create the KML_FOLDER attribute and B) grab the layer description to put it in the KML_FOLDER value? (I would like to give <feature name> this value as well, but it's not as important.)

Like to script it because not looking forward to manually doing this. As I change or add layers, I'd like to have a simple script to do this too.

I think I can figure out how to create the attribute, (copy existing one and rename it? Must be a more direct way?) but it's finding the layer description that's bugging me. When I inspect a feature, above the list of attributes there is Name, Feature Type, Geometry and "Map Name"... which appears to hold the value I want.

(I'm still using GM11 btw, in case this is something more easily done in a newer version...)

Thanks in advance!

Comments

Sign In or Register to comment.