6

I'm trying to use OpenLayers to transform projections, which in turn uses the http://proj4js.org/ library.

  var ll = new OpenLayers.Projection('EPSG:4326');
  var a = new OpenLayers.LonLat(3,53).transform(ll,new OpenLayers.Projection('EPSG:900913'));
  var b = new OpenLayers.LonLat(3,53).transform(ll,new OpenLayers.Projection('EPSG:27700'));

a will have transformed fine, b will not.

Is it possible to get support for EPSG:27700?

http://osgeo-org.1803224.n2.nabble.com/Reprojecting-Google-td1827338.html suggests adding in a extra class, but that's 2 years old so I'm hopeing it's improved since then.

6

did you include the proj4js files? By default OpenLayers only includes the transforms from 4326 to/from 900913 to save space. See http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js for more details and other links on how to include the proj4s library.

1

proj4js javascript code actually goes out to http://spatialreference.org/ to get the info as a last resort (after looking for a local definition and a local JS file). But... http://spatialreference.org/ looks to be down right now. I haven't gone to it in a while so don't know when it went down or when it'll be back up.

However, a while back I grabbed most of the definitions from the website and this is it for 27700 and it matches @iant's post above

Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs";

If anyone needs other definitions from spatialreference.org there's a zip file with 4000+ definitions available in this thread on OSGEO.

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.