I have a program that automatically generates KML files for use with Google Earth. My most recent output is pasted below:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<Placemark>
<name>Active Location</name>
<address>60 NORTH WILLOW STREET, MONTCLAIR, ESSEX County, New Jersey</address>
</Placemark>
</Document>
</kml>
When this file is opened, a rectangular polygon is generated around the placemark, like so:
Saving the placemark as another document gives the following content:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>QueryOutput.KML</name>
<Placemark>
<name>Active Location</name>
<address>60 NORTH WILLOW STREET, MONTCLAIR, ESSEX County, New Jersey</address>
<MultiGeometry>
<Point>
<coordinates>-74.2122552,40.8157007,0</coordinates>
</Point>
<LinearRing>
<coordinates>
-74.21556655758907,40.81321718180819,0 -74.21556655758907,40.81818421819181,0 -74.20894384241093,40.81818421819181,0 -74.20894384241093,40.81321718180819,0 -74.21556655758907,40.81321718180819,0
</coordinates>
</LinearRing>
</MultiGeometry>
</Placemark>
</Document>
</kml>
Users must be able to collect the latitude/longitude data of the Point
, which is then copied into another form. Because the placemark is defined as a MultiGeometry, they do not have easy access to this data. What changes need to be made to the initial KML file to prevent the placemark from generating a MultiGeometry? I've tried placing the name
and address
tags inside a Point
, but that causes the coordinates to be set to 0,0,0 when the file is loaded.
When KML file has only an address, Google Earth will automatically do an address lookup to get an approximate location with a point and an error bounds with the box. Saving the KML after it opens in Google Earth will automatically add the location as a MultiGeometry to the feature.
Only way to prevent Google Earth from automatically adding the MultiGeometry to the KML is first adding a Geometry (Point, Line, etc.) to the KML. The alternative is to either edit the resulting KML in a text editor or manually do an address lookup in Google Earth then create a new placemark at the location it finds.
Searching an address in Google Earth
https://support.google.com/earth/answer/148081?hl=en