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

# How to get longitude and latitude from bound?

 0 The below code will return the lat & lon values, when i click any where on the map. The result is lon=8931183.8958044,lat=1456094.8596215 ``````map.events.register('click', map, handleMapClick); function handleMapClick(e) { var lonlat = map.getLonLatFromViewPortPx(e.xy); alert(lonlat); } `````` how to get the lat & lon exactly when clicking on the map what is the extact format for lat and lon Is this the correct lat & lon? because I see that the Lat & Lon comes in 2 digit (0-90) before can some one help me in converting the values? asked 13 Jun '13, 16:06 gayathri 11●2●2●3 accept rate: 0% 2 This is an OpenLayers question not OpenStreetMap try GIS Stack Exchange, read a bit about projections, and this blog post might be useful http://macwright.org/2012/01/12/openlayers.html. (14 Jun '13, 15:14) SK53 ♦

 0 lonlat.lon, lonlat.lat answered 13 Jun '13, 19:42 yvecai 1.5k●12●26 accept rate: 9% Is this the correct lat & lon? because I see that the Lat & Lon comes in 2 digit (0-90) before can some one help me in converting the values? (14 Jun '13, 05:42) gayathri I guess you have read this http://wiki.openstreetmap.org/wiki/Bounding_box and noticed that it uses degrees and fractions in decimal format NOT degrees Minutes and Seconds so 45.5 deg= 45,30,00 DMS. If that does not help what lat lon were you expecting to get back from your code. Could you set it up so you know the result beforehand as a test? (14 Jun '13, 19:46) andy mackey 1 thank for u kindly reply.... i got answer (15 Jun '13, 07:26) gayathri ``````var fromProjection = new OpenLayers.Projection("EPSG:4326"); var toProjection = new OpenLayers.Projection("EPSG:900913"); var mapbounds = map.getExtent(); // to getting the bounds var bound = mapbounds.transform(toProjection, fromProjection ); // converting the bounds to left, right, bottom & top values. `````` (15 Jun '13, 07:29) gayathri

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×55
×3
×1

question asked: 13 Jun '13, 16:06

question was seen: 6,572 times

last updated: 16 Jun '13, 18:52

### Related questions

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