Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created the very simple tool which utilizes OpenLayers.Format.WKT with DrawFeature - polygon and ModifyFeature together, so I can create and modify, load and save polygons in/from WKT format. I've had it working on OpenLayers.Layer.WMS, but now I'd like to work on OSM map as I need the city names to be shown.

The problem is that after changing the layer type, the polygon is loaded properly - it's displayed somewhere else than it is supposed to be. Here is my loading code (simplified)

var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS","", {layers: 'basic'});

// when using this, it doesnt work properly: var wmsLayer = new OpenLayers.Layer.OSM( "OpenLayers OSM");

var features =;
features.geometry.transform(map.displayProjection, map.getProjectionObject())

I believe this is due to transformation problem, but I don't know how to fix it...

share|improve this question
up vote 1 down vote accepted

I think the osgeo map is in CRS WGS84 and OSM is 900913. Therefore I am assuming your WKT features are in WGS84 as they display properly.

You need to change this line:-

features.geometry.transform(map.displayProjection, map.getProjectionObject())


features.geometry.transform(new OpenLayers.Projection('EPSG:4326'), map.getProjectionObject())
share|improve this answer
Thank you, it did worked. – migajek Jul 26 '13 at 16:06

Your Answer


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.