Hi,<br><br>I'm trying to cast a point in one projection into another, and I think I have some issues with OpenLayers.Projection. Below is html/javascript code I'm using and the rendered browser ouput. In this example, I'm trying to cast the point (184056.505, 4809728.250) in epsg:26915 to epgs:4326. My expectation is that point p, which is this point in epsg:26915, should display as something on the order of (-100,43), or something close to that range. However, as the output shows, the point is not changed. Can someone explain why?<br>
<br>Thanks,<br>matt<br><br>P.S. - Is there an error in the documentation for the constructor of OpenLayers.Projection (at: <a href="http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Projection-js.html#OpenLayers.Projection.OpenLayers.Projection">http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Projection-js.html#OpenLayers.Projection.OpenLayers.Projection</a>)? It says that the constructor takes an object to set parameters, but every example I see of the constructor is passing a string in the way I am setting it here. Am I not understanding the documentation conventions correctly, or is this not correctly or completely documented?<br>
<br><br>=== html/javascript code ===<br><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"><br> <head><br> <title>OpenLayers Example</title><br><!-- <script src="<a href="http://www.openlayers.org/api/OpenLayers.js">http://www.openlayers.org/api/OpenLayers.js</a>"></script> --><br>
<script src="<a href="http://localhost/_common//OpenLayers-2.6/OpenLayers.js">http://localhost/_common//OpenLayers-2.6/OpenLayers.js</a>"></script><br> </head><br><br> <body><br><br>
<pre><br> <script type="text/javascript"><br> var p = new OpenLayers.Geometry.Point(184056.505, 4809728.250);<br> var proj_src = new OpenLayers.Projection("EPSG:26915");<br>
var proj_tgt = new OpenLayers.Projection("EPSG:4326");<br><br> document.writeln();<br> document.writeln("Point p [before OpenLayers.Projection.transform] is: " + p);<br> OpenLayers.Projection.transform(p,proj_src,proj_tgt);<br>
document.writeln("Point p [after OpenLayers.Projection.transform] is: " + p);<br> document.writeln("proj_src is: " + proj_src);<br> document.writeln();<br> <br> document.writeln("prj_src walk of properties is:");<br>
document.writeln("------------------------------");<br> for (prop in proj_src) {<br> document.writeln(prop + " => " + proj_src[prop]);<br> };<br> document.writeln("------------------------------");<br>
</script><br> </pre><br> </body><br><br></html><br>========================================================================<br><br>=== browser rendered output ===<br>
<pre> <br>Point p [before OpenLayers.Projection.transform] is: POINT(184056.505 4809728.25)<br>Point p [after OpenLayers.Projection.transform] is: POINT(184056.505 4809728.25)<br>proj_src is: EPSG:26915<br><br>prj_src walk of properties is:<br>
------------------------------<br>projCode => EPSG:26915<br>proj => null<br>initialize => function (projCode, options) {<br> OpenLayers.Util.extend(this, options);<br> this.projCode = projCode;<br> if (window.Proj4js) {<br>
this.proj = new Proj4js.Proj(projCode);<br> }<br>}<br>getCode => function () {<br> return this.proj ? this.proj.srsCode : this.projCode;<br>}<br>getUnits => function () {<br> return this.proj ? this.proj.units : null;<br>
}<br>toString => function () {<br> return this.getCode();<br>}<br>equals => function (projection) {<br> if (projection && projection.getCode) {<br> return this.getCode() == projection.getCode();<br>
} else {<br> return false;<br> }<br>}<br>destroy => function () {<br> delete this.proj;<br> delete this.projCode;<br>}<br>CLASS_NAME => OpenLayers.Projection<br>------------------------------<br>
</pre>========================================================================<br>
<br>