I'm currelty capturing my mouse click event and trying to transform the coordinates into Long Lat. I need to get at the Long Lat as strings so I can build a url and throw it at Google Street view. Current transform code only prints the BNG coords.

lonlat = map.getLonLatFromPixel(e.xy);

brit = new OpenLayers.Projection("EPSG:27700");
google = new OpenLayers.Projection("EPSG:900913");

lonlatclone = lonlat.clone()
lonlatclone.transform(brit, google)
//alert("You clicked near " + lonlatclone.lat + "N," + +lonlatclone.lon + "E");


4 Answers 4


Did you import the proj4js definitions for EPSG:27700? http://spatialreference.org/ref/epsg/27700/proj4js/

27700 is not included by default.


For any projection different than EPSG:4326 and EPSG:900913 you need to attach the proj4js project with projection definitions


EPSG:900913 (which is deprecated, you should really be using its modern synonym EPSG:3857) is a projected CRS, not lon/lat. So if you want a spherical mercator result, you'll need to transform from lon/lat to EPSG:3857, skipping EPSG:27700 completely.

Or if your getLonLatFromPixel() results are in EPSG:27700, you'll need to use EPSG:4326 as your destination.


Have you tried this?

var newLonLat = lonlatclone.transform(brit, google);

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .