[OpenLayers-Trac] [OpenLayers] #3050: OpenLayers is drawing layers at wrong coordinates

OpenLayers trac-20090302 at openlayers.org
Wed Feb 9 12:37:40 EST 2011

#3050: OpenLayers is drawing layers at wrong coordinates
 Reporter:  scap2000   |       Owner:  euzuro      
     Type:  bug        |      Status:  new         
 Priority:  major      |   Milestone:  2.11 Release
Component:  Layer.WMS  |     Version:  2.10        
 Keywords:             |       State:              
 I've created a point on a PostGIS table at POINT(-65.4013118577086
 -24.7894029247747) with EPSG:4326 projection.

 The code for the html file is below (I tried with hosted "/api" version,
 "/dev" version and packaged version with same results)

 <html xmlns="http://www.w3.org/1999/xhtml">
     <link rel="stylesheet" href="../theme/default/style.css"
 type="text/css" />
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         .olControlAttribution { bottom: 0px!important }
         #map {
             height: 512px;

     <script type="text/javascript"

     <script src="http://openlayers.org/dev/OpenLayers.js"

     <script type="text/javascript">

         // make map available for easy debugging
         var map;

         // avoid pink tiles
         OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
         OpenLayers.Util.onImageLoadErrorColor = "transparent";

         function init() {
             var options = {
                 projection: new OpenLayers.Projection("EPSG:900913"),
                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
                 units: "m",
                 numZoomLevels: 18,
                 maxResolution: 156543.0339,
                 maxExtent: new
             map = new OpenLayers.Map('map', options);

             // create Google Mercator layers
             var gmap = new OpenLayers.Layer.Google(
                 "Google Streets",
                 {'sphericalMercator': true}

             var ghyb = new OpenLayers.Layer.Google(
                 "Google Hybrid",
                 {type: google.maps.MapTypeId.HYBRID, 'sphericalMercator':

             // create WMS layer
             var wms = new OpenLayers.Layer.WMS(
                 "Test layer",
                 {'layers': 'test_point', 'format':'image/jpeg',
                     'isBaseLayer': false,'wrapDateLine': true,singleTile:

             // create a vector layer for drawing
              var vector = new OpenLayers.Layer.Vector("Editable Vectors");

             map.addLayers([gmap, ghyb, wms]);
             map.addControl(new OpenLayers.Control.LayerSwitcher());
             //map.addControl(new OpenLayers.Control.Permalink());
             map.addControl(new OpenLayers.Control.MousePosition());
             //map.setCenter(new OpenLayers.LonLat(-63.764648,
 -24.082031).transform(new OpenLayers.Projection("EPSG:4326"), new
 OpenLayers.Projection("EPSG:900913")), 3);
             if (!map.getCenter()) {map.zoomToMaxExtent()}

   <body onload="init()">
     <h1 id="title">Parry Sound ATV Club</h1>

     <div id="tags">
     <p id="shortdesc">

         Sample map showing Seguin Trail</p>
     <div id="map" class="smallmap"></div>

     <div id="docs">

 When the map starts, the point is drawn correctly at the exact
 coordinates, but once I reach the 5 or 6 zoom level, it jumps around 5
 degrees to east. Attached images below

 '''Image 1: the point is drawn over the "Salta" Label (almost at the left
 of the image)'''

 '''Image 2: zooming, the point is drawn right to the east (almost at the
 right of the image)'''

 If I play with the layercontrol buttons, some times the point is drawn
 (for some milliseconds) at the right position and then jumps again to the

 I tried zooming up but nothing is shown, also starting with smaller
 bounds, still got the error.

Ticket URL: <http://trac.openlayers.org/ticket/3050>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer

More information about the Trac mailing list