How to get map corner latlong in OSM.
i have many tried to solve it but i did not solve it.
i have use below example.
===================================================
<html>
<head>
<title>OpenLayers Demo</title>
<style type="text/css">
html, body, #basicMap
{
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script src="http://www.openlayers.org/api/OpenLayers.js" type="text/javascript"></script>
<script type="text/javascript">
function init() {
var marker_layer = new OpenLayers.Layer.Markers("Markers");
var map = new OpenLayers.Map("basicMap");
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var position1 = new OpenLayers.LonLat(78.9629, 20.5937).transform(fromProjection, toProjection);
var position2 = new OpenLayers.LonLat(79.2629, 20.9937).transform(fromProjection, toProjection);
var zoom = 8;
map.addLayer(mapnik);
map.setCenter(position1, zoom);
debugger;
var bounds = map.getBounds(); //Error : map.getBounds is not a function
var vv1 = map.getView().calculateExtent(); //Error : map.getView is not a function
}
</script>
</head>
<body onload="init();">
</body>
</html>
===================================================
asked
15 Jul '16, 08:30
Jatin Patel
11●5●5●7
accept rate:
0%
Isn't this a duplicate of https://help.openstreetmap.org/questions/50696/how-to-get-map-corner-latlong-using-open-layer ?
If possible then write a solution for above query...
Thanks in advance.