[OpenLayers-Users] Mouse position coordinates

Graham Gauld graham.gauld at aberdeenshire.gov.uk
Wed Jul 27 06:45:42 EDT 2011


I'm new to OpenLayers.
I have a problem with my OpenLayers application which affects the display of
the mouse cursor position coordinates and the placement of points digitised
onto a Vector layer: namely that the displayed coordinate values and placed
symbols are located just to the south-east of where the mouse cursor
actually is.

For example:

actual cursor position
clicked on the map  ==>     +

                                            +        <== center of symbol
placed at clicked point by my application


I believe the problem lies with a mismatch between the cursor position
OpenLayers is getting and the true cursor position - if I place the cursor
over a series of points where I know the true coordinates, the coordinate
readout from OpenLayers is consistently for a point just to the south-east
of the true position.

My map is contained in an HTML <div> element within an HTML table cell, and
has a row of command buttons above it (<input type="image" etc>) and an
ASP.net TreeView to the left of it. I've noticed that in a version of the
application with no TreeView to the left (but still with a row of command
buttons above the map), the problem is still present but apparently not as
bad - i.e. the offset to the south-east looks less severe.

Could the position of the map <div> element in relation to surrounding HTML
element in the page cause the coordinates problem?


I'm using the British National Grid projection as follows:

var mapOptions = 
            {
                units : "mm",
                projection: 'GENS:uk_british_national_grid_mm',
                scales: [1500000, 1100000, 100000, 50000, 10000, 5000, 2500,
1250, 500, 250],
                maxExtent : maxBounds
            };
            
            
map = new OpenLayers.Map('map', mapOptions);


The problem appears to exist in both IE and FF.

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mouse-position-coordinates-tp6625649p6625649.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list