Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
trac.osgeo.org/proj4js/browser/trunk/lib/defs does not seem to have a file for 27700, or am I missing something? –  James Jan 6 '11 at 15:14
1  
A quick google gives (openspace.ordnancesurvey.co.uk/openspaceforum/…) 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 "; EPSG27700 = new OpenLayers.Projection( "EPSG:27700" ); –  iant Jan 6 '11 at 15:31
    
That seems to work, thank you! –  James Jan 6 '11 at 16:57

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.

share|improve this answer
    
Good to know, thank you –  James Jan 6 '11 at 17:05

Your Answer

 
discard

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.