Google Earth Pro: version 7.1.7.2602
Renderer: DirectX
I have one placemark that is a linear feature. The feature is a road, so I want to apply a style to it that sets its color and its physical width. When the style is defined in the same file as the placemark, the style is applied correctly. I see the desired color and physical width.
However, when the style is defined externally in another file, the style is not fully applied correctly. I see the desired color, but the physical width is not applied; the line width remains at the default.
The KML file that contains the placemark and the KML file that contains the external style are in the same directory. I know that the former KML file can find the latter KML file, because the color of the style is applied correctly.
Why does the physical width for the style not work when the style is external? Is it because physicalWidth property is an extended property (i.e., in the gx namespace)?
Things that I have tried to migitate the problem.
- Closing and relaunching Google Earth.
- Clearing both the memory and disk caches in Google Earth.
- Giving the external style a different name than the in-file style, in case that was confusing Google Earth.
The following is a simple example that demonstrates the problem.
Example that works
Placemark and style are in the same file.
topeka2.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2" >
<Document>
<name>topeka test 2</name>
<description>Linear feature, in-file style</description>
<Style id="road_big">
<LineStyle>
<color>ff00ffff</color>
<gx:physicalWidth>50</gx:physicalWidth>
<gx:outerWidth>0.25</gx:outerWidth>
<gx:outerColor>88000000</gx:outerColor>
</LineStyle>
</Style>
<Placemark>
<name>road #1</name>
<styleUrl>#road_big</styleUrl>
<LineString>
<coordinates>
-95.706132,39.036977,0.0
-95.706219,39.029695,0.0
-95.696957,39.029696,0.0
-95.696851,39.036896,0.0
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
Example that does not work
Placemark and style in different files.
topeka3.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2" >
<Document>
<name>topeka test 3</name>
<description>Linear feature, external style</description>
<Placemark>
<name>road #1</name>
<styleUrl>topeka_styles.kml#road_big_external</styleUrl>
<LineString>
<coordinates>
-95.706132,39.036977,0.0
-95.706219,39.029695,0.0
-95.696957,39.029696,0.0
-95.696851,39.036896,0.0
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
topeka_styles.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2" >
<Document>
<name>topeka styles</name>
<Style id="road_big_external">
<LineStyle>
<color>ff00ff00</color>
<gx:physicalWidth>50</gx:physicalWidth>
<gx:outerWidth>0.25</gx:outerWidth>
<gx:outerColor>88000000</gx:outerColor>
</LineStyle>
</Style>
</Document>
</kml>
Screenshot
Following is a screenshot of Google Earth. The wide yellow road demonstrates that the in-file style works. The thin green road demonstrates that the physicalWidth of the external style does not work.