<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ben,<br>
<br>
Running that point in the test page of Proj4js, I get:<br>
231394.84, 902621.11<br>
(which is also almost exactly the same result I get from PROJ.4) and
off from your expected result by centimeters.<br>
<br>
Are you using the correct initialization string?<br>
<pre>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";</pre>
(also at <a class="moz-txt-link-freetext" href="http://spatialreference.org/ref/epsg/26986/proj4js/">http://spatialreference.org/ref/epsg/26986/proj4js/</a>)<br>
<br>
Mike<br>
<br>
<br>
On 9/17/2010 3:19 PM, Ben Krepp wrote:
<blockquote cite="mid:00dd01cb569d$470c3e30$d524ba90$@ctps.org"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The following snippet of JavaScript code is
sufficient to expose the issue:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">// Begin code snippet<o:p></o:p></p>
<p class="MsoNormal"> var oSrcPrj = new
Proj4js.Proj('EPSG:4236');<o:p></o:p></p>
<p class="MsoNormal"> var oDestPrj = new
Proj4js.Proj('EPSG:26986');<o:p></o:p></p>
<p class="MsoNormal"> var oPoint = new
Proj4js.Point(-71.11881762742996,42.37346263960867);<o:p></o:p></p>
<p class="MsoNormal">
Proj4js.transform(oSrcPrj,oDestPrj,oPoint);<o:p></o:p></p>
<p class="MsoNormal"> alert("Transformed
LatLng->MassStatePlane coordinates are: X = " + oPoint.x +
" Y = " + oPoint.y);<o:p></o:p></p>
<p class="MsoNormal">// End code snippet<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When run, the coordinates of the
transformed point are:<o:p></o:p></p>
<p class="MsoNormal" style="text-indent: 0.5in;">X =
230616.5448393133, Y = 902165.5744436784<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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:<o:p></o:p></p>
<p class="MsoNormal"> X = 231394.7344, Y =
902622.1875<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So, there is a large discrepancy between
the actual and expected results.<o:p></o:p></p>
<p class="MsoNormal">Am I using the library incorrectly, or is
there a bug in Proj4js?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for any light that can be shed on
this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Ben Krepp<o:p></o:p></p>
<p class="MsoNormal">Manager of Information Technology, GIS, and
Data Services<o:p></o:p></p>
<p class="MsoNormal">Central Transportation Planning Staff<o:p></o:p></p>
<p class="MsoNormal">10 Park Plaza<o:p></o:p></p>
<p class="MsoNormal">Suite 2150<o:p></o:p></p>
<p class="MsoNormal">Boston, MA 02115<o:p></o:p></p>
<p class="MsoNormal">e-mail: <a moz-do-not-send="true"
href="mailto:bkrepp@ctps.org">bkrepp@ctps.org</a><o:p></o:p></p>
<p class="MsoNormal">phone: 617-973-7137<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
MetaCRS mailing list
<a class="moz-txt-link-abbreviated" href="mailto:MetaCRS@lists.osgeo.org">MetaCRS@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/metacrs">http://lists.osgeo.org/mailman/listinfo/metacrs</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Michael Adair
Senior Software Architect
DM Solutions Group Inc.
Office: (613) 565-5056 x26
<a class="moz-txt-link-abbreviated" href="mailto:madair@dmsolutions.ca">madair@dmsolutions.ca</a>
<a class="moz-txt-link-freetext" href="http://www.dmsolutions.ca">http://www.dmsolutions.ca</a>
<a class="moz-txt-link-freetext" href="http://research.dmsolutions.ca">http://research.dmsolutions.ca</a>
</pre>
</body>
</html>