Reputation: 1857
I have created a 'dynamic java project'(java7) using eclipse luna and succesfully rendered a map from postgis-postgresql database using geoserver & openlayers-2.13. Now I want to get the latitude & longitude values of center point on each map movement,so that I can print the map with current position. My code is :
var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.WMS( "District Boundary","http://localhost:8080/geoserver/gwc/service/wms/sde", {layers: 'sde:district_boundary' } );
map.addLayer([layer]);
map.setCenter(new OpenLayers.LonLat(76.452, 10.528), 7);
map.events.register("move", map, function() {
console.debug('lat : '+map.getCenter().lat());
});
But I am getting error like this TypeError: map.getCenter(...).lat is not a function
Upvotes: 0
Views: 924
Reputation: 13181
The error message is clear: lat
is a property, not a function, so you should not call it via p.lat()
but p.lat
.
Also, the error message indicates you didn't post the code you're really running - don't do that as it may make investigating your problem impossible.
Upvotes: 1