[MetaCRS] Proj4js problem: EPSG:4236 to EPSG:26986 transformation
Mike Adair
madair at dmsolutions.ca
Fri Sep 17 15:44:42 EDT 2010
Ben,
Running that point in the test page of Proj4js, I get:
231394.84, 902621.11
(which is also almost exactly the same result I get from PROJ.4) and off
from your expected result by centimeters.
Are you using the correct initialization string?
Proj4js.defs["EPSG:26986"] = "+proj=lcc +lat_1=42.68333333333333 +lat_2=41.71666666666667 +lat_0=41 +lon_0=-71.5 +x_0=200000 +y_0=750000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
(also at http://spatialreference.org/ref/epsg/26986/proj4js/)
Mike
On 9/17/2010 3:19 PM, Ben Krepp wrote:
>
> Hi all,
>
> I'm trying to use the Proj4js library to transform coordinates from
> the Google Maps SRS (EPSG:4236) to the Massachusetts State Plane NAD83
> meters SRS (EPSG:26986) SRS, but am running into problems.
> Specifically, the results I'm getting are off by a several hundred
> meters for both the X and Y values.
>
> The following snippet of JavaScript code is sufficient to expose the
> issue:
>
> // Begin code snippet
>
> var oSrcPrj = new Proj4js.Proj('EPSG:4236');
>
> var oDestPrj = new Proj4js.Proj('EPSG:26986');
>
> var oPoint = new
> Proj4js.Point(-71.11881762742996,42.37346263960867);
>
> Proj4js.transform(oSrcPrj,oDestPrj,oPoint);
>
> alert("Transformed LatLng->MassStatePlane coordinates
> are: X = " + oPoint.x + " Y = " + oPoint.y);
>
> // End code snippet
>
> The oPoint variable represents the location of the Harvard Square MBTA
> station in Cambridge, MA., as reported by Google Maps .The coordinate
> values were obtained by printing them out in a simple Google Maps
> onclick event handler.
>
> When run, the coordinates of the transformed point are:
>
> X = 230616.5448393133, Y = 902165.5744436784
>
> According to the MassGIS MBTA_NODE GIS layer, which uses the
> Massachusetts State Plane NAD83 meters (i.e., EPSG:26986) SRS, the
> coordinates of this point are:
>
> X = 231394.7344, Y = 902622.1875
>
> So, there is a large discrepancy between the actual and expected results.
>
> Am I using the library incorrectly, or is there a bug in Proj4js?
>
> Thanks for any light that can be shed on this.
>
> Ben Krepp
>
> Manager of Information Technology, GIS, and Data Services
>
> Central Transportation Planning Staff
>
> 10 Park Plaza
>
> Suite 2150
>
> Boston, MA 02115
>
> e-mail: bkrepp at ctps.org <mailto:bkrepp at ctps.org>
>
> phone: 617-973-7137
>
>
> _______________________________________________
> MetaCRS mailing list
> MetaCRS at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/metacrs
--
Michael Adair
Senior Software Architect
DM Solutions Group Inc.
Office: (613) 565-5056 x26
madair at dmsolutions.ca
http://www.dmsolutions.ca
http://research.dmsolutions.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/metacrs/attachments/20100917/0ecbfcc4/attachment.html
More information about the MetaCRS
mailing list