Tuesday, 12 November 2019

OpenLayers/proj4js and the EPSG:27700 (UK) Projection


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.



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...