I have a KML file that uses EPSG:4326. Is there any way to plot this onto a Google Map (v3) which uses Mercator?

Here is the page I am working on

The district data comes from one source and is Google friendly.

The outage data is generated by the power company using their GIS system. It shows a list of power outages. However nothing is shown on the map. Have seen this file work in openlayers but I really have no clue why it would not be showing up.

  • winelisthq.com/outages.kml is a 404 for me. Dec 8 '10 at 21:38
  • Is the MIME types set for this webserver? Google Earth reads KML and KMZ files. The MIME type for KML files is * application/vnd.google-earth.kml+xml The MIME type for KMZ files is * application/vnd.google-earth.kmz For Apache, add these lines to the httpd.conf file: * AddType application/vnd.google-earth.kml+xml .kml * AddType application/vnd.google-earth.kmz .kmz
    – Mapperz
    Dec 8 '10 at 22:54

Does the file display correctly (in the right location) in Google Earth? If so it will be okay to overlay in Google Maps API.

  • I have tried to plot this in Google Maps and it does not display at all. Plotting a single point from this file puts me in Antarctica :S
    – aaronfarr
    Dec 8 '10 at 19:56

Edit: reproject it to wgs84. You can do this with ogr2ogr using the -t_srs switch.

Once it is in wgs84/EPSG 4326. Take a look at this example: http://code.google.com/apis/maps/documentation/javascript/examples/layer-kml.html

The .kml file used there is in lat, lng and plots without issue.

  • This is in Mercator format though. The file I have is not in that same standard Google Maps format though. Which is quite inconvenient. OpenLayers supports different projections but I am not sure how this is achieved in native GoogleMaps.
    – aaronfarr
    Dec 8 '10 at 20:18
  • 1
    EPSG 4326 is a lat, lng based coordinate system, see: spatialreference.org/ref/epsg/4326. If your .kml is actually in web mercator, you'll need to reproject it. Dec 8 '10 at 20:26
  • 1
    Just out of curiosity, where did you get this kml file? I don't think I've ever dealt with any kml that wasn't in lat, lng. Dec 8 '10 at 20:28
  • Hi Swingley, I think you caught an error there. I am not exactly sure which system google uses. But I have no clues as to what is generating the file or how to make it project properly :( Linked the a sample page if that helps. Thank you!
    – aaronfarr
    Dec 8 '10 at 21:26
  • 1
    @aaronfarr, can you post a sample coordinate from the outages file? Plus, what city/county/etc. should the data be in?
    – mkennedy
    Dec 9 '10 at 19:09

Try this site and see if the KML/KMZ file is loaded properly. Our KML/KMZ files always had to be in WGS84 EPSG:4326. The other alternative is to use Google Earth to load the file. If you can't load it in Google Earth, then the KML/KMZ file is corrupt.


This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .