Why google map won't show mark to me?

Why won’t my basic KML file show a map of Japan?

  • I recently bought “http://www.amazon.com/exec/obidos/ASIN/1590597079/metafilter-20/ref=nosim/” and am already having a problem with the first chapter. Going over KML files and how they can be used to mark certain areas on a Google Map, the book gives an example of multiple points in Toronto. I followed the same example to try and mark a point in Yokosuka, Japan. When I view the Toronto example, it works fine. When I try my Yokosuka example, it just displays a point marker on a blank grey background; the map never loads. I’ve tried both the Toronto KML file and my Yokosuka KML file on my server, and only Toronto works. I've checked the coordinates by manually searching for them in GMaps and Yokosuka comes up fine. Here’s my KML file (also found http://fewl.net/yokosuka.kml): <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.google.com/earth/kml/2"> <Document> <name>yokosuka.kml</name> <Placemark> <name>Yokosuka Japan</name> <description> This is my first KML file. Insert some random crap about Yokosuka. </description> <Point> <coordinates>35.277647,139.665585</coordinates> </Point> </Placemark> </Document> </kml> As you can see, it doesn’t show anything but a point with no map. You can see the Toronto example works though. http://fewl.net/toronto.kml. Am I doing something wrong? Is there something wrong with GMaps in foreign countries? I really don’t want to give up this book after the first chapter, so please help me out here. Thanks!

  • Answer:

    Your cordinates are backwards. If you look at the yahoo geocode response for Toronto (using yahoo because it can be accessed on the web without a special key :p) <ResultSet xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd"> − <Result precision="zip"> <Latitude>43.648565</Latitude> <Longitude>-79.385329</Longitude> <Address/> <City>Toronto</City> <State>ON</State> <Zip/> <Country>CA</Country> </Result> </ResultSet> If you compare that with your Toronto KML file - the coordinate are entered in the order Longitude, Latitude There are a buch of entries for Yokusa so these coords may not be an exact match for yours but they're close enough: <Result precision="zip"> <Latitude>35.260159</Latitude> <Longitude>139.661758</Longitude> <Address/> <City>yokosuka-shi</City> <State>Japan</State> <Zip/> <Country>JP</Country> </Result> which would make your coordinates 139.66, 35.26 approx but you have them the other way around. As a point of interest if you were using point = new GLatLng() the coordinates would be 35, 139 (approx) not the other way around. Dont ask me why but I stumbled into this problem on a few days ago - I requested coordinates from googles geocode service and it gave me 7.010593,43.550871, 0 as a coordinate response, but to use them as coords for a googlemap point they should be 43.550871, 7.010593

jimdanger at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

From http://code.google.com/apis/kml/documentation/kml_tut.html, I'm guessing your second line (namespace definition) needs to be something like: <kml xmlns="http://earth.google.com/kml/2.1">

paulsc

@paulsc: I made a copy of the original file with the suggested change, but I get the same result.

jimdanger

OK, thats just weird. Your coordinates match those given for Yokosuka in Google Earth but in your file they take you to the middle of the ocean. If you change them to -35.277647,139.665585 the kml file takes you to just off the coast of Japan.

demagnetized

That's why I was wondering if GMaps had issues with Japan. If that's the case, is there a workaround?

jimdanger

missmagenta: That worked! That's strange that it's backwards, but now I know. Thanks so much.

jimdanger

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.