Reputation: 727
I want to be able to overlay layers on to map using geoxml3. I have been struggling to try to understand what could be going wrong, since it works fine for points, BUT it display nothing when it comes to polygon and linestring. Though it seems that it is going through the geoxml3 parser since the zooming is being adjusted accoding to the data, but nothing will be displayed.
All the three versions of geoxml3 I have tried and all same result.
The following is my linestring kml file. Mind you the file works fine on google maps and google earth.
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Name>route</Name>
<Placemark>
<Style>
<LineStyle>
<color>ff0000ff</color>
</LineStyle>
</Style>
<LineString>
<coordinates>14.5077989214673,35.8935010311257 14.5077613878199,35.8935045284545 14.5077103878199,35.8935219284544 14.5076594878199,35.8935697284545 14.5076594878199,35.8935697284545 14.506821184327,35.894410303289 14.5066562791164,35.8947140342037 </coordinates>
</LineString>
</Placemark>
</Document>
</kml>
The following is the javascript method to handle the parsing.
function displayKml() {
geo = new geoXML3.parser({
map: map,
zoom: true,
singleInfoWindow: true
});
geo.parse("Uploads/" + document.getElementById('<%= text2.ClientID %>').value);
}
Any help is appreciated since I have been for three days now trying to figure it out.
Upvotes: 0
Views: 1290
Reputation: 161334
The <LineString>
in your KML doesn't have a width
<Style>
<LineStyle>
<color>ff0000ff</color>
</LineStyle>
</Style>
Add:
<Style>
<LineStyle>
<width>1</width>
<color>ff0000ff</color>
</LineStyle>
</Style>
The polys branch of geoxml3 currently doesn't have a default for width (so it is zero, which means you can't see it):
polys branch without width: http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/SO_IT_info_kmlB.xml
polys branch with width: http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/SO_IT_info_kmlC.xml
the kmz branch of geoxml3 does have a default for width, that should have worked:
kmz branch with your original KML: http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/SO_IT_info_kmlB.xml
Opened an issue against geoxml3
Fixed the issue (so the examples above all work and no longer show the problem)
Upvotes: 1