[OpenLayers-Users] need help with projection issues

O. Baum oli.b at freenet.de
Fri Jan 18 11:04:30 EST 2008


Hi Thomas, all,

2008/1/16, Thomas Wood <grand.edgemaster at gmail.com>:
> Yes, you will. displayProjection just tells controls to reproject
> before displaying or parsing coords they use.
>
> Reprojecting is fairly simple: [...]

ok, that works.

BUT if I want to draw a circle with the help of
OpenLayers.Geometry.Polygon.createRegularPolygon() it becomes an
ellipse. :(
I'm using this code:

---8<---------------------------------
var circOrigin = new OpenLayers.Geometry.Point( 10.00, 49.50 );
var circStyle = OpenLayers.Util.extend( {},
OpenLayers.Feature.Vector.style["default"] );
var circleFeature = new OpenLayers.Feature.Vector(
 OpenLayers.Geometry.Polygon.createRegularPolygon( circOrigin, 0.001, 20, 0 ),
 null,
 circStyle );
circleFeature.geometry.transform( new
OpenLayers.Projection("EPSG:4326"), new
OpenLayers.Projection("EPSG:900913") );
vectors.addFeatures( [circleFeature] );
--->8---------------------------------

2 questions:

a) How and where can I apply the transformation so my circle is
'really' (i.e. on the map) a circle?
b) In what units is the radius given? How can I calulate it from Meters?

Thanks for Your help!


Best regards,

   O. Baum



More information about the Users mailing list