Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to show a map on my website. I have 2 different kinds of KML files that need to be plotted. One defines region boundaries. The other points within those boundaries. The region boundaries are in standard google map format. The points are in "EPSG:4326" format.

Is google maps the right tool for the job or should I use something else? I heard openlayers is an alternative.

share|improve this question
as long as the KML has latitude & longitude coordinates in decimal degrees it will not matter about EPSG:4326 – Mapperz Dec 8 '10 at 3:31

Using v3 Google Maps API

Note: The KML File(s) need to be publicly accessible - on a webserver Google Maps API has limited KML support (simple lines, points, polygons are okay)

change: var ctaLayer = new google.maps.KmlLayer(''); ctaLayer.setMap(map); to your kml

and the var chicago = new google.maps.LatLng(41.875696,-87.624207); to your centre point.

<!DOCTYPE html>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: KmlLayer KML</title>
<link href="" rel="stylesheet" type="text/css" />
<script type="text/javascript" src=""></script>
<script type="text/javascript">
function initialize() {
  var chicago = new google.maps.LatLng(41.875696,-87.624207);
  var myOptions = {
    zoom: 11,
    center: chicago,
    mapTypeId: google.maps.MapTypeId.ROADMAP

  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  var ctaLayer = new google.maps.KmlLayer('');
<body onload="initialize()">
  <div id="map_canvas"></div>

share|improve this answer
This is great Mapperz thank you. I was able to successfully plot one of my KML files to the map. The one I know was made for google maps. However, the other KML is not showing up at all. This is one that is in a different projection. Is there a way of changing or specifying the project format? – aaronfarr Dec 8 '10 at 18:43
No all data needs to be projected to WGS84 for overlaying on Google and Bing Maps. To add another KML layer - var ctaLayer2 = new google.maps.KmlLayer('yourother.kml'); ctaLayer2.setMap(map); – Mapperz Dec 8 '10 at 19:50

Google maps is certainly one way of displaying KML files on a website, and it is quite easy. The documentation of google maps is good (see here); I haven't used openlayers so cannot compare.

share|improve this answer
As I've learned recently(…), Google Maps doesnt use WGS84 projection - it's Mercator. Source: – radek Dec 8 '10 at 11:59
@ radek The google documentation says Google Earth uses WGS84 I didn't realize google maps was different (I updated my answer). – djq Dec 8 '10 at 14:38
And I deleted the part about re-projection as I just realized it was irrelevant after reading Mapperz's comment. – djq Dec 8 '10 at 14:44

You could combine the two kml files together and then put the result into the Google Earth API, no coding required via this gadget:

In this instance GEarth has the advantage that you can see the terrain in 3D (if that's important) but the disadvantage that on a global scale you can't see all the data at once.

share|improve this answer

this might be helpful:

share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – iant Aug 14 '12 at 9:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.