4

I want to draw a rectangle. The coordinates are somewhere in northern Germany. But the rectangle shows up in the Near East? What am I doing wrong?

       var epsg900913 = new OpenLayers.Projection('EPSG:900913');
       var epsg3035   = new OpenLayers.Projection('EPSG:3035');

       var p11 = new OpenLayers.Geometry.Point(4281000, 3502000).transform(epsg3035, epsg900913);
       var p12 = new OpenLayers.Geometry.Point(4595000, 3502000).transform(epsg3035, epsg900913);
       var p13 = new OpenLayers.Geometry.Point(4595000, 4002000).transform(epsg3035, epsg900913);
       var p14 = new OpenLayers.Geometry.Point(4281000, 4002000).transform(epsg3035, epsg900913);
       var p15 = new OpenLayers.Geometry.Point(4281000, 3502000).transform(epsg3035, epsg900913);
7

Alright, I found it out myself. The transformation of EPSG:3035 is not defined by Proj4js, which is used by OpenLayers.

But it is possible to implement it by yourself.

  1. Download proj4js.js
  2. Include proj4js-combined.js to the HTML
  3. Get EPSG code for proj4js: can be found at spatial reference
  4. Define it, in my case it looked like that:

    Proj4js.defs["EPSG:3035"] = "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs";

see also

  • +Very helpful and explained well – Ferenjito Oct 30 '14 at 13:37
  • In the current version the syntax has changed, you now have to write: proj4.defs("EPSG:3035", "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"); – nathanvda Dec 14 '14 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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