How to get Map corner latlong using open layer.??? i had tried with map.getBounds() method but it shows error like "map.getBounds is not a function" so kindly reply for this error or any example. here i had use OpenLayers.js asked 07 Jul '16, 08:44 Jatin Patel edited 07 Jul '16, 09:24 scai ♦ |
3 Answers:
For OpenLayers 3 you have to look at the map extent by calling answered 07 Jul '16, 09:24 scai ♦ map.getView().calculateExtent() does not work in OpenLayer3. i use below link in open layer. (11 Jul '16, 08:15) Jatin Patel 1 This is OpenLayers 2. (11 Jul '16, 08:24) scai ♦ 1 Your (12 Jul '16, 10:56) scai ♦ |
Above Both function not working. below is the my code, please correct it. ===================================== <html> <head> <title>OpenLayers Demo</title> <style type="text/css"> html, body, #basicMap { width: 100%; height: 100%; margin: 0; } </style>
</head> <body onload="init();"> <input id="Button1" type="button" value="Click Here" onclick="GetData();"/> </body> </html>===================================== answered 12 Jul '16, 10:39 Jatin Patel edited 12 Jul '16, 10:40 |
At this i have not use function but still i got an error. ============================================== <html> <head> <title>OpenLayers Demo</title> <style type="text/css"> html, body, #basicMap { width: 100%; height: 100%; margin: 0; } </style>
</head> <body onload="init();"> </body> </html>============================================== answered 12 Jul '16, 12:32 Jatin Patel Try (16 Jul '16, 07:47) scai ♦ Then what was the formula for find corner latlong.???? (19 Jul '16, 10:34) Jatin Patel 2
(19 Jul '16, 10:45) scai ♦ Is there any calculation for getting corner latlong from the getExtend(). because i got only one value from left, bottom, right and top. so kindly help me. (21 Jul '16, 06:48) Jatin Patel Please take some time and read through the documentation. See OpenLayers.LonLat, just pass the corresponding corners in the constructor. (21 Jul '16, 07:38) scai ♦ Thanks a lot sir... i got solution for my question but now i want to set view using this bounds left, bottom, right,top and zoom. so how can i do this.??? (27 Jul '16, 07:22) Jatin Patel showing 5 of 6 show 1 more comments |
You have to provide more information. Show us the part of your code where
getBounds()
is failing.