NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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="" 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.setCenter(position1, zoom);


        var bounds = map.getBounds();       //Error : map.getBounds is not a function

        var vv1 = map.getView().calculateExtent();  //Error : map.getView is not a function


</head> <body onload="init();">

</body> </html>


asked 15 Jul '16, 08:30

Jatin%20Patel's gravatar image

Jatin Patel
accept rate: 0%

closed 16 Jul '16, 07:47

scai's gravatar image

scai ♦

If possible then write a solution for above query...

Thanks in advance.

(16 Jul '16, 07:13) Jatin Patel

The question has been closed for the following reason "Duplicate Question, see" by scai 16 Jul '16, 07:47

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Jul '16, 08:30

question was seen: 2,575 times

last updated: 16 Jul '16, 07:47

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum