[OpenLayers-Users] Openlayers.Bounds().transform() not doing
transform
Michael Adair
madair at dmsolutions.ca
Tue Nov 1 10:29:47 EDT 2011
Did you include the definition for EPSG:26915? Otherwise it will try to
look it up via a proxy.
Proj4js.defs["EPSG:26915"] = "+proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
Mike
On 31/10/2011 10:41 PM, Matthew Pettis wrote:
> I am trying to do a coordinate transform of bounds in Openlayers, and
> have tried the following, which, for both console.log() statements,
> gives me the same bounds in both cases (but I expect the second
> statement to give me bounds in EPGS:4326):
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Bounds Example</title>
> <script src="/OpenLayers-2.10/OpenLayers.js"></script>
> <script type="text/javascript">
> function init(){
> var fromProjection = new
> OpenLayers.Projection("EPSG:26915");
> var toProjection = new OpenLayers.Projection("EPSG:4326");
> var extent = new
> OpenLayers.Bounds(189775.379950,4816289.746171,761662.354535,5472414.143295);
> console.log(extent);
>
> console.log(extent.transform(fromProjection,toProjection));
> }
> </script>
> </head>
> <body onload="init()">
> </body>
> </html>
>
> In both console.log() statements, I get the following object (c&p from
> Chrome javascript debugger):
>
> Class
> bottom: 4816289.746171
> centerLonLat: null
> left: 189775.37995
> right: 761662.354535
> top: 5472414.143295
> __proto__: Object
>
> I read the documentation for proj4js with openlayers here, and it
> tells me:
>
> OpenLayers integrates with Proj4js if the library is available. This
> will make using it a bit easier. Having it in the same folder as
> OpenLayers.js will make it available.
>
> Which I did via a symlink:
>
> matt at xxxxxxxx:/var/www/xxxxx$ ll /var/www/OpenLayers-2.10/
> total 1008
> drwxr-xr-x 13 matt matt 4096 Nov 1 01:49 .
> drwxrwxrwx 30 root root 4096 Nov 1 01:43 ..
> -rw-r--r-- 1 matt matt 945828 Sep 9 2010 OpenLayers.js
> ...
> lrwxrwxrwx 1 matt matt 31 Nov 1 01:49 proj4js.js ->
> /var/www/proj4js/lib/proj4js.js
> ...
>
> Can someone help me diagnose what I'm doing wrong here?
>
> Thanks, Matt
>
> PS -- I've crossposted from stackoverflow, as I don't know which place
> is getting more activity --
> http://stackoverflow.com/questions/7961872/openlayers-bounds-transform-not-doing-transform
>
>
> --
> Do not seek to follow in the footsteps of the wise men of old. Seek
> what they sought.
>
> - Matsuo Munefusa ("Basho")
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111101/d8fd78d8/attachment-0001.html
More information about the Users
mailing list