Hello Guy,
I recently had a similar problem when moving a marker. I got the click position with:

map.getLonLatFromViewPortPx(xy)

when trying to move the existing marker on the layer with getLonLatFromViewPortPx I saw the same offset as you describe.

Using map.getLayerPxFromViewPortPx(xy) instead solved the problem.
Hope that helps...

Daniel



Am 01.07.2013 13:31, schrieb Guy Griffiths:
I am having an issue using the WMS GetFeatureInfo control in
OpenLayers.  I am using OpenLayers for a custom WMS client. Generally
speaking the GetFeatureInfo functionality works very well.  However,
when I select a new WMS layer there is a chance that the absolute
position of the map may move (so that a full title can be displayed
above the map).  If this happens, subsequent calls to GetFeatureInfo
give the wrong co-ordinates - shifted by the same amount as the map has
moved.  It appears as though the GetFeatureInfo control is calculating
the I and J pixel co-ordinates according to the original (absolute)
position of the map and is not changing this if the position of the map
changes.

If anyone could help with how to avoid/work around/fix this problem, I'd
be most grateful.

Regards,

Guy Griffiths
Reading eScience Centre
_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Helmholtz-Zentrum Geesthacht Zentrum für Material- und Küstenforschung GmbH Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus Amtsgericht Lübeck HRB 285 GE (Register Court) Internet: http://www.hzg.de _______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to