[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">
<head>
<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;
}
</style>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://openlayers.org/dev/OpenLayers.js"
type="text/javascript"></script>
<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
OpenLayers.Bounds(-8904913.793982677,5655499.2850054335,-8865778.035507679,5694635.0434804335)
};
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':
true}
);
// create WMS layer
var wms = new OpenLayers.Layer.WMS(
"Test layer",
"http://localhost:8080/geoserver/wms",
{'layers': 'test_point', 'format':'image/jpeg',
'transparent':'true','srs':'EPSG:4326'
},
{
'isBaseLayer': false,'wrapDateLine': true,singleTile:
true
}
);
// 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.EditingToolbar(vector));
//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()}
}
</script>
</head>
<body onload="init()">
<h1 id="title">Parry Sound ATV Club</h1>
<div id="tags">
</div>
<p id="shortdesc">
Sample map showing Seguin Trail</p>
<div id="map" class="smallmap"></div>
<div id="docs">
</div>
</body>
</html>
}}}
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(http://i.imgur.com/5CYWq.png)]]
'''Image 2: zooming, the point is drawn right to the east (almost at the
right of the image)'''
[[Image(http://i.imgur.com/L3yX0.png)]]
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
right.
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