1
votes

I am creating polygons using KML and am having issues as I am encountering the poles where the 180 intersects. For example, I have issues in regards to these set of coordinates to create a KML of the extents:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
    <name>Name</name>
    <description>Description</description>
<Style id="SwathPolygonStyle"><LineStyle><color>ff00ffff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<Style id="FramePolygonStyle"><LineStyle><color>ff82ffff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<Style id="RegionPolygonStyle"><LineStyle><color>ff0000ff</color> </LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<Folder>
<name>here-1</name>
<Placemark>
<name>here-1</name>
<description>
Hello:Hello
</description>
<styleUrl>#SwathPolygonStyle</styleUrl>
<MultiGeometry>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-72.058493,-176.622811,0
-70.502050,-173.022317,0
-68.887565,-169.929116,0
-67.227255,-167.248426,0
-64.953185,-176.004274,0
-66.451642,-178.990172,0
-67.886604,177.654724,0
-69.245042,173.875146,0
-70.511090,169.613436,0
-71.665730,164.815015,0
-72.525277,160.384696,0
-75.985382,169.327427,0
-74.926496,174.165622,0
-72.058493,-176.622811,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</MultiGeometry>
</Placemark>
</Folder>
</Document>
</kml>

All other KML in this format have worked for me. For some reason, when creating a kml using these coordinates, the KML is not correct, leading to a polygon nowhere near my AOI.

Any help would be appreciated. Thank you.

1

1 Answers

1
votes

Your KML is invalid. Running it through the validator gives:

Sorry

This feed does not validate.

line 36, column 0: Invalid latitude found within coordinates. Latitudes have to be between -90 and 90.: -176.622811 (14 occurrences) [help]

</coordinates>

Looks to me like you have the latitudes and longitudes reversed, <coordinates> are in the order longitude,latitude,[altitude], no spaces allowed, altitude is optional.

If I reverse the coordinates, I get a polygon near the South Pole, but it doesn't work with the Google Maps Javascript API v3 KmlLayer (probably this issue)