Google Earth places placemarks at wrong location [duplicate] - kml

This question already has an answer here:
After importing KML to Google Maps, point is showing in Antartica
(1 answer)
Closed 7 years ago.
I have been trying to locate the place marks of the data I logged.
I used the following KML code to locate my points as Placemarks.Unfortunately and Surprisingly the points are placed at wrong location.I am just wondering if there is any error in my KML code.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns = "http://earth.google.com/kml/2.1">
<Document>
<Style id="icon_id">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/blu-blank.png</href>
<scale>1.0</scale>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>04-02-2015</name>
<description>Points</description>
<styleUrl>#icon_id</styleUrl>
<Point>
<coordinates>39.6495820075,-79.96055352125</coordinates>
</Point>
</Placemark>
<Placemark>
<name>04-02-2015</name>
<description>Points</description>
<styleUrl>#icon_id</styleUrl>
<Point>
<coordinates>39.649492665,-79.96053303</coordinates>
</Point>
</Placemark>
</Document>
</kml>
I also tried locating the points manually on Google Earth and they show the location perfectly.But when I try running the KML code it screws me.
p.s. The points are supposed to be in WV,US while Google Earth Places it at some place in Antarctica.
I used Android LocationManager API to log my latitude and longitude values.

Yes its a map Projection.
I went through the following link https://support.google.com/earth/answer/148110?hl=en and as suggested used a tool available at http://www.earthpoint.us/Convert.aspx to convert my coordinates and worked.
The change made was writing in the order <coordinates>longitude,latitude</coordinates> instead of
<coordinates>latitude, longitude</coordinates> from the (latitude,longitude) pair generated by Android Location Manager API.

Related

LabelStyle.... Why won't this code produce red font on half size labels?

I'm doing a proof-of-concept map. Goal is half sized labels, with red font, and no icon. I've tried everything, even copy pasting from the google KML reference manuals and many examples posted here. What am I missing? I'm trying to display the map in both Google's "My maps" and also as a called data file at the browser utility gmap4. The test map should show four labels with Google streetmap of Pennsylvania for a baselayer...... Thanks for any help.
<?xml version="1.0" standalone="yes"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<Style id="NoIconRedTextHalfSize">
<IconStyle>
<scale>.1</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/paddle/grn-stars.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<Color>FF1400FF</Color>
<Scale>.5</Scale>
</LabelStyle>
</Style>
<Folder>
<Placemark>
<name>Hs-4-C.Sonney</name>
<styleUrl>#NoIconRedTextHalfSize</styleUrl>
<Point>
<coordinates>1,1,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Hs-5-B.Jozwiak</name>
<styleUrl>#NoIconRedTextHalfSize</styleUrl>
<Point>
<coordinates>1,1,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Hs-6-B.Roae</name>
<styleUrl>#NoIconRedTextHalfSize</styleUrl>
<Point>
<coordinates>1,1,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Hs-7-M.Longietti</name>
<styleUrl>#NoIconRedTextHalfSize</styleUrl>
<Point>
<coordinates>1,1,0</coordinates>
</Point>
</Placemark>
</Folder>
</Document>
</kml>
The KML syntax includes a number of tags that are not supported by plain Google maps (my map) or by sotfware based on the Google map API. One of the non-supported tags is .
See: https://developers.google.com/maps/documentation/javascript/kmllayer#supported-elements
To make a label with no icon try making a transparent icon.

Specific lat lng in KML can't be shown

I am trying to show the following coordinates in kml but it can't be shown correctly with Google Maps:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark>
<name>Invercargill Rocks!</name>
<description>Go there and see!</description>
<Point>
<coordinates>43.006687,144.391647</coordinates>
</Point>
</Placemark>
</kml>
I use the following site to check if the kml works:
http://display-kml.appspot.com/
It works with the following coordinates but doesn't work with mine.
(works) 168.34693908691406,-46.416322245553296
(doesn't work) 43.006687,144.391647
Could you somebody tell me why?
As geocodezip mentioned, the correct order has to be lng and lat.

KML opens with the wrong geoposition

I'm trying to create a map of the Stockholm's subway lines in Fusional Tables.
In the Fusion Tables I created a map with geo each station:
https://www.google.com/fusiontables/DataSource?docid=1K7F2DMY5JBA6ZQOH8a1a4dQjwxoksRDMJ3-wPEg#map:id=3
I want to connect them to the polyline.
Options to create polylines and way in the tables there, or they are very well hidden.
So I created this KML file and loaded into tables:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Stockholms T-bana</name>
<description>Karta över röda linjen i Stockholms T-bana</description>
<Style id="redLine">
<LineStyle>
<color>FF0000</color>
<width>2</width>
</LineStyle>
</Style>
<Placemark>
<name>Röda linje</name>
<description>T-bana linje</description>
<styleUrl>#redLine</styleUrl>
<LineString>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>59.330947,18.059263,2357
59.335258,18.074055,2357
59.343169,18.081243,2357
59.345826,18.071712,2357
59.365568,18.054891,2357
59.381508,18.036516,2357
59.392019,18.041697,2357
59.398709,18.03622,2357
59.338683,18.091242,2357
59.347202,18.098793,2357
59.357298,18.102218,2357
59.32316,18.06762,2357
59.319309,18.072295,2357
59.316958,18.063308,2357
59.317778,18.050152,2357
59.316057,18.033714,2357</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
Maps created in the table stubbornly opened in the Arabian Sea but not in Stockholm.
https://www.google.com/fusiontables/data?docid=1trp44L7vNDqPVDmTr1yXmGUpBvS7_U6R0MnBsS4#map:id=3
What is my fault? Is there some other way create polylines in tables between objects?
You have the coordinates backwards. KML coordinates are longitude,latitude,altitude.
Sweden:
https://maps.google.com/maps?q=59,18&hl=en&sll=18,59&sspn=61.939621,78.046875&t=m&z=16
Arabian Sea:
https://maps.google.com/maps?q=18,59&hl=en&sll=18,59&sspn=61.939621,78.046875&t=m&z=16
Your KML with the coordinates corrected

delaying balloon component in a KML code

I have just started to learn how to manipulate the KML files. here is a problem that I do not know how to overcome.... I created a polygon and added a description to be shown as a balloon, but it appears as soon as Google Earth starts working before the polygon can be seen. what I want is to show the balloon from a specific distance where the polygon appears(for example in the range distance of LookAt element).
anybody knows how to manage that?
my code follows:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" mlns: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">
<LookAt>
<longitude>17.99514610290434</longitude>
<latitude>59.36293893395309</latitude>
<altitude>0</altitude>
<range>597.51212259908</range>
<tilt>52.34415598649959</tilt>
<heading>105.3974737169693</heading>
</LookAt>
<Placemark>
<name>Stadium</name>
<description>
<![CDATA[
this is <b><i>Råsunda soccer stadium</i></b>
]]>
</description>
<gx:balloonVisibility>1</gx:balloonVisibility>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>
17.99514610290434,59.36293893395309,100 17.99651951950199,59.36209399425741,100 17.99752330705672,59.36252751885282,100 17.99613146514916,59.36335387902954,100 17.99514610290434,59.36293893395309,100
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
</kml>
Normally you can skip rendering the polygon until you get "close" enough to it as defined by a Region element which is determined by calculating when a given area maps to a min or max # of pixels.
Also, the <gx:balloonVisibility> tag forces the description balloon to appear when the KML is loaded regardless of whether Region is active. Adding a Region direct in the KML still shows the popup balloon.
To do what you want to do, you must wrap the KML file with a second KML file with a NetworkLink with a Region that loads the seconds KML only when the region is active (aka close enough) at which time the description is displayed along with the polygon.
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<LookAt>
<longitude>17.99514610290434</longitude>
<latitude>59.36293893395309</latitude>
<altitude>0</altitude>
<heading>105.3974737169693</heading>
<tilt>52.34415598649959</tilt>
<range>597.51212259908</range>
</LookAt>
<NetworkLink>
<Region>
<LatLonAltBox>
<north>59.363792</north>
<south>59.361556</south>
<east>17.998029</east>
<west>17.994443</west>
</LatLonAltBox>
<Lod>
<minLodPixels>128</minLodPixels>
<maxLodPixels>-1</maxLodPixels>
</Lod>
</Region>
<Link>
<href>target.kml</href>
</Link>
</NetworkLink>
</Document>
</kml>
And target.kml file contains the original KML you gave:
<?xml version="1.0" encoding="ISO-8859-1"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Stadium</name>
...
</Placemark>
</kml>
You can change the distance the feature + balloon appears by adjusting the minLodPixels value and/or the size of the region. At present the feature will display when the region defined by area surrounding the polygon is at least 128 pixels on the screen. Change to 32 or 64 and/or make the region area larger to make it appear quicker.
Note Google Earth client doesn't give you a tool to edit or even see the Region bounding boxes on the map so debugging this is tricky. You can paste your KML into this tool to generate KML making the Region bounding area visible. This helps to debug Regions more easily.

KML file not showing correct location and polygon orientation. Syntax issue?

Hi I wrote a Javascript to output a KML file based on a polygon area marked on google maps api v3. The file used to worked correctly, showed the right location and polygon shape on Google Earth Pro
Now suddenly instead of showing the London Eye area in London it shows an area in Congo and the polygon doesnt even appear correctly on google earth. I tried to debug it appears that the coordinate seems to be causing the problem. However, when i save it to MyPlaces on google maps online it parses the KML and shows the shape and location properly. Thanks for your help. KML Below
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>test</name><description>test</description>
<Style id='style1'>
<LineStyle>
<width>5</width>
</LineStyle>
<PolyStyle>
<color>0FF00000</color>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<Placemark>
<name>?</name>
<styleUrl>#style1</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<tessellate>1</tessellate>
<coordinates>
51.50519078602326, -0.12681582942195746,
51.50708732603467, -0.12381175532527777,
51.50553804573176, -0.1123104430694184,
51.50166461450478, -0.11462787165828558,
51.50519078602326, -0.12681582942195746,
</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
</Document>
</kml>
Your KML is invalid, and Google Earth is no longer as permissive as it was in accepting this type of invalid coordinates.
Specifically, you have an extra comma at end of each line in your KML -- so just remove them, or else add the optional altitude value after them.
Also remove the whitespace between the separate parts of the coordinate. Your coordinates will now be converted to three separate coordinates by Google Earth:
51.50519078602326,0,0 and -0.12681582942195746,0,0 and 0,0,0.
Change it to:
51.50519078602326,-0.12681582942195746,0
51.50708732603467,-0.12381175532527777,0
Or:
51.50519078602326,-0.12681582942195746
51.50708732603467,-0.12381175532527777
See https://developers.google.com/kml/documentation/kml_tut#polygons for a polygon example or the section and https://developers.google.com/kml/documentation/kmlreference#linearring for extra details.

Resources