Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My script allows you to drawn shapes on an openlayers map, and then to get the WKT information from that shape, except the returned coordinates are in 900913 and i need them to be in lat/lon. thanks

share|improve this question
    
Welcome to GIS Stack Exchange! I'm not sure if you had trouble posting a relevant snippet from your code to indicate where you thought your problem might lie but I think you will need to do so in order to get assistance. –  PolyGeo Jun 3 '13 at 10:31
add comment

1 Answer 1

You need to project (transform) the shape from EPSG:900913 (actually use the standard EPSG:3857) to EPSG:4326.

You can use the following code:

var gcs=new OpenLayers.Projection("EPSG:4326");
var webMercator=new OpenLayers.Projection("EPSG:3857");

/*I am assuming that you have a polygon in web mercator. You can do this for points and lines as well*/
var polygon_wgs84=poly.transform(webMercator, gcs);

//now you can convert the polygon to wkt
console.log(polygon_wgs84.toString(););
share|improve this answer
    
@ Devdatta - Thanks.... –  Sandipan Saha Jun 3 '13 at 12:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.