[MetaCRS] Possible Proj4js 1.1.0 problem: EPSG:900913 <--> EPSG:26986 transformation

Ben Krepp bkrepp at ctps.org
Wed Sep 19 12:48:26 PDT 2012


Hi all,

 

I'm running into problems using Proj4js to transform coordinates between
ESPG:900916 ("web Mercator") and EPSG:26986 (Massachusetts mainland state
plane NAD83, meters) and vice-versa. The results I'm getting are way off.

 

I've constructed a minimal test case that illustrates the problem:

 

[ BEGIN CODE]

function initialize() {      

                Proj4js.reportError = function(msg) { alert('Proj4 error: '
+ msg); } ;

                

                // Massachusetts State Plane NAD83, meters

                var oDestPrj = new Proj4js.Proj('EPSG:26986');

                // Google "web mercator"

                var oSrcPrj = new Proj4js.Proj('EPSG:900913');    

 

                // A point location in web mercator.

                var myPoint = { x: -73.21132, y: 42.71387 };

 

                // Project my point to EPSG:26986.

                Proj4js.transform(oSrcPrj, oDestPrj, myPoint);

                

                // Result should be (approximately) 59819.70, 941765.22

                document.write("x : " + myPoint.x + " y : " + myPoint.y);

}

[ END CODE]

 

In the example above, the input point { x: -73.21132, y: 42.71387 } is
transformed into { x : 9220379.520106662 y : -186260.82310388796 }.

 

I'm using a newly downloaded copy of Proj4js 1.1.0, the SRS definition for
EPSG:900913 that came with the Proj4js download, and the SRS definition for
EPSG:26986 downloaded from www.spatialreference.org.

 

I've either stumbled upon a bug, or am doing something incredibly
bone-headed. 

Any help that might be offered would be much appreciated.

 

Thanks,
Ben

 

Benjamin Krepp  |  Manager of GIS and IT

CENTRAL TRANSPORTATION PLANNING STAFF

617.973.7137  | bkrepp at ctps.org

 <http://www.ctps.org/bostonmpo> www.ctps.org/bostonmpo

Description: Description: cid:5F54AF76-729F-48CE-9BEE-5E4887E4DA63

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/metacrs/attachments/20120919/7edfd4ff/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 14765 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/metacrs/attachments/20120919/7edfd4ff/attachment-0001.png>


More information about the MetaCRS mailing list