Any ideas on how to get my raster overlay lined up properly on google maps? The geoserver layer is re-projected from EPSG:4269 to 3857 before serving it to google maps. To me it looks as if the longitudes are flipped.

Here is my code snippet and output on JSFiddle.

Here is the javascript:

function display_kmlmap() {
  var map_options = {};
  var map = new google.maps.Map(document.getElementById("map_canvas"), map_options);

  var kmlUrl = 'http://geoserver.usanpn.org/geoserver/si-x/wms?service=wms&request=GetMap&version=1.1.1&format=kml&layers=si-x:zabelli_bloom_prism&styles=leafout&height=1000&width=1000&transparent=true&bbox=-125.02083333333302,24.06249999929686,-66.479166666662,49.937499999073005&srs=EPSG:4326';
  var kmlOptions = {
    map: map

  var kmlLayer = new google.maps.KmlLayer(kmlUrl, kmlOptions);

and html:

<body onload="display_kmlmap()">
  Testing SI-X kml overlay.
  <div id="map_canvas" style="width:500px; height:400px; float:left">

And a screenshot: enter image description here

Here is a geoserver screenshot of my layer crs reprojection and bounding box: enter image description here

Here is the KML file as produced by geoserver:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:ns2="http://www.google.com/kml/ext/2.2" xmlns:ns3="http://www.w3.org/2005/Atom" xmlns:ns4="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">

If I edit the KML file and swap the values for east and west like so:


and point Google Maps to the edited KML file then the raster overlays correctly. However, I don't want to manually edit the KML files.

Update (Aug 24, 2017) - Never did figure this out and we ended up not using kml to deliver these maps. I will point out that this server is currently running geoserver version 2.10.1.

  • Please put useful code and a screenshot in the question body, so that folks who won't (or can't) follow links aren't excluded from answering. This way the question can't be broken if a different site goes dark.
    – Vince
    Commented Dec 8, 2015 at 18:08
  • Please post the extents and coordinate system of your raster. Is it georeferenced?
    – mkennedy
    Commented Dec 8, 2015 at 18:44
  • Are you sure that the bbox parameter of your kmlURL is in the right order?
    – AndreJ
    Commented Dec 9, 2015 at 6:37
  • @AndreJ They are listed as minx,miny,maxx,maxy. &bbox=-125.02083333333302,24.06249999929686,-66.479166666662,49.937499999073005 The problem is that minx is getting mapped to east and maxx is getting mapped to west, but since they are both negative this should be reversed. Is there a way to flip the mapping?
    – apricity
    Commented Dec 9, 2015 at 18:38
  • I have the same problem, do you found a solution? I'm using geoserver 2.7.2
    – Cintia
    Commented Jan 18, 2016 at 11:54

1 Answer 1


It looks like it might be a GeoServer bug on creating the KML.

I can see that a GetMap request with image/png output works:


(I changed the width and height values to avoid distortion)

So asking for KML (I think the correct MIME type for the format is application/vnd.google-earth.kml+xml) as below should work, but as you say the West and East bounds are swapped.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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