Solved

KML Layer order


Badge +14

In much the same was as you can order the sequence of layers in a PDF, I'd like to do the same in a KML file. I'm not talking about the draw order though, I mean the appearance and sequence of layers. By default it appears to be alphabetic in order. So you'd get:

Rail

Rivers

Roads

...by default if you wrote them out to KML.

But what if I wanted:

Rivers

Roads

Rail

I don't want to put the layers into a KML folder and I don't want to change the featuretype name in any way. I thought it first setting kml_draw_order might be an option but that appears to relate to the render order on the map rather than the layer order in the 'Places' list.

Is it possible? Thanks in advance.

icon

Best answer by jdh 5 June 2018, 20:39

View original

4 replies

Badge +22

I've always just used a sorter prior to the writer, and the features appear in the places menu in the order they are written.

Badge +14

I've always just used a sorter prior to the writer, and the features appear in the places menu in the order they are written.

Curious. Am I missing something obvious? I'm doing that here by adding an order based on feature origin:

 

...but as you can see the layer order is still alphabetical in the resulting KML.
Badge +3

I've always just used a sorter prior to the writer, and the features appear in the places menu in the order they are written.

The features can be sorted in any order as you need, like @jdh mentioned, but the feature classes appear in alphabetical order in the KML file. I had the same problem when I did my big KML project a few years back, and had to prefix the feature class names with a number to get the order I wanted.

 

Badge +22
Curious. Am I missing something obvious? I'm doing that here by adding an order based on feature origin:

 

...but as you can see the layer order is still alphabetical in the resulting KML.
If you want the folders to be in a specific order, you need to create them explicitly, rather than implicitly.

 

 

There's also an oddity that both the folders and the placemarks need to be sorted, if the placemark stream isn't sorted prior to the writer, then the folder order is not maintained.

 

kml-folder-order.fmw

 

 

Reply