[OpenLayers-Users] map.getCenter returns 0

Giga jimderpanse at googlemail.com
Fri Oct 26 05:51:13 PDT 2012


Hi,

I'm using Openlayers to display high resolution images with Zoomify layer.
It is also possible to add features to the map with a button. So each time
the user hits the button, he is asked to enter some attributes for the
feature and afterwards the feature shall be added to the current center of
the view.
To get the right position I use map.getCenter().lon and map.getCenter().lat.
However, this does not work in some cases. Especially if I zoom in very deep
and want to add a feature, it doesn't get added properly, because
map.getCenter doesn't return the correct coordinates. Instead it returns 0
for the longitude value.

The data for the features is stored in a database, so to get the relevant
ones for the current view I need to get the extent of the current view after
each move event. I use map.getExtent() for this and I have the same problem
here. In most cases everything works fine, but sometimes (especially if
zoomed in deep) both longitude values that are returned are 0.

What could I do wrong?

Thanks for any help,
Giga



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/map-getCenter-returns-0-tp5011533.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list