ThinkGeo.com    |     Documentation    |     Premium Support

KML Layer Text Z-level

Hello,

I am showing a KML layer on our map, that includes lines and text. When I look at the layer in Google Earth, the text is on top of the lines, and can be read easily. When I show the layer on our map, the lines are on top of the text, and is harder to read. Is there a property or something I can adjust to get the text to draw over the lines? Also, the code builds an .idx file for the KML file if there isn’t one.

Here is the code the loads the layer:

    Dim kmlLayer As New KmlFeatureLayer(fileName)
    kmlLayer.FeatureSource.Projection = proj4
    kmlLayer.ZoomLevelSet.ZoomLevel04.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
    kmlLayer.IsVisible = True
    kmlLayer.Transparency = 255
    kmlLayer.Name = layerName
    kmlLayer.DrawingQuality = DrawingQuality.HighQuality
    stormOverlay.Layers.Add(kmlLayer.Name, kmlLayer)

The KMZ can be found at:
https://www.nhc.noaa.gov/storm_graphics/api/EP142018_016adv_most_likely_toa_34.kmz

Thanks,
Dib

Hi Dib,

I tried to download the kmz and I cannot make it rendered correct in my project.

But I think you should want to set this property:

kmlLayer.StylingType = KmlStylingType.StandardStyling;

Because its default value is KmlStylingType.EmbeddedStyling and you cannot modify the style of it.

But after you set it to StandardStyling, you can try to set the text style and see whether it work follow your requirement.

Regards,

Ethan

Ethan,

I don’t see the text style settings anywhere to try them out. If I set the StylingType to StandardStyling, the layer does not show on the map.

I was wondering about the order that the MapShapes are in. It looks like the time labels are added first to the mapShape collection (indexes 0 - 32), and the lines (as lineStrings) are all added after them (indexes 33-44). Are the shapes drawn in the order they are in in the MapShapes collection? Can I change the order in code?

Dim kk As New Collection(Of MapShape)
kk = kmlLayer.GetAllMapShapes(fileName)

Does that make sense?

So I got it to work by rewriting the KML layer in code, and moving the label items to the end of the KML file. That way the line shapes are drawn first, as they are now the first shapes in the KML file, and the label shapes are drawn after them.

Is there some sort of draw order property that would have done this? Something like .DrawOrder = FirstToLast or LastToFirst?

Thanks

Hi Dib,

We don’t have a property like the DrawOrder you mentioned.

If you set StylingType to StandardStyling, you should want to set the default style to ZoomLevel just like any other layer in our map. If you don’t set it, that means the shape don’t have its style, so the map will be empty.

Regards,

Ethan