I am new to Openlayers and I am moving my application from Google Map to Openlayers. And also successfully displaying Polygons (coordinates captured via Google Map in Decimal Degrees - default for Google Maps), When I am drawing the polygon on a layer and on onFeaturesAdded Event, while getting co-ordinates of added feature like this

 var tArr = event.features[0].geometry.getVertices();

output comes out like

[POINT(-919690.32419922 -5068080.7227148),POINT(1780677.0106836 -6868325.6126367),POINT(1819812.7691602 -6868325.6126367)

But, while I am drawing this feature back to OpenLayers displays NOTHING.

Questions are :

1). Google Uses Decimal Degrees Notions to give points of Geometry, Openlayers give in which GIS notation ? (searched on web found nothing)

2). When I am saving co-ordinates in same Projection and redrawing it back, give nothing to me, why ?

thanks for any help.

  • 1
    Please explain what does it mean: "But, while I am drawing this feature back to OpenLayers"?
    – drnextgis
    Commented Feb 20, 2013 at 15:09
  • 1
    You need to be aware of something called 'Projection' of the map. Google Maps API can use lat-long values, even though the map is in web Mercator. In OpenLayers, if your map has a different projection than your point, you need to project it. Also: How are you drawing the points on the map? What code are you using? That might be the cause of the issue. Commented Feb 23, 2013 at 3:06
  • @drnextgis, my meaning from words, "But, while I am drawing this feature back to OpenLayers", was when I was adding polygon composed of Decimal Degrees coordinates to vector, It was displaying.
    – Anil
    Commented Feb 25, 2013 at 6:36
  • @DevdattaTengshe, you are right, What I needed is Projection to the Map. Thanks alot, it solved my problem.
    – Anil
    Commented Feb 25, 2013 at 6:38

1 Answer 1


If question is about converting geometry to string; and then converting string back to geometry, I suggest to use WKT format (http://en.wikipedia.org/wiki/Well-known_text).

Convert geometry to WKT string:

var myWkt = event.features[0].geometry.toString();

and re-creating geometry from WKT string:

var myGeom = new OpenLayers.Geometry.fromWKT(myWkt);
var myFeat = new OpenLayers.Feature.Vector(myGeom);

And forget that Decimal degrees stuff :) It just means, coordinates are represented as decimal numbers (i.e. 25.5 instead of 25* 30').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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