[OpenLayers-Users] conversion of bounding boxes to various projections

Mike Adair madair at dmsolutions.ca
Tue May 19 10:04:01 EDT 2009


And you also need to include proj4js (http://trac.osgeo.org/proj4js/) 
and and definition for EPSG:42304.  There is an example included in the 
recently updated graticule patch v2 for this 
http://trac.openlayers.org/ticket/1083

Mike

Eric Lemoine wrote:
> On Monday, May 18, 2009,  <stephane.poirier at usherbrooke.ca> wrote:
>   
>>
>>
>>
>>
>>
>> Hi All,
>>
>> Is it easy to use openlayers to convert bounding
>> boxes from one EPSG to another.
>>
>> With WGS84 world geodesic datum projection
>> EPSG:4326, North America has a bounding box of
>> defaultBounds=new OpenLayers.Bounds(-180, 5, -10,
>> 85); //north america, working with google, nasa, metacarta, etc.
>> var myproj=new
>> OpenLayers.Projection(myepsg);
>>
>> With Lambert Conic Conformal projection EPSG:42304,
>> Canada has a bounding box of
>> defaultBounds=new
>> OpenLayers.Bounds(-2750564.75,-936638.5,3583872.5,4673125); //canada
>> var
>> myepsg="EPSG:42304"; //Lambert Conic Conformal, working with http://atlas.gc.ca/cgi-bin/atlaswms_en
>> var
>> myproj=new OpenLayers.Projection(myepsg);
>>
>> Q: How can I have the bounding box for North
>> America in EPSG:42304?
>>     
>
> Hi
>
> bounds.transform(fromProj, toProj);
>
> Cheers,
>
>   
>>
>> Stephane
>>
>>
>>
>> Stephane Poirier - Research professional
>> Center
>> of Applications in Remote Sensing
>> Applied Geomatics Department
>> University
>> of Sherbrooke
>> Sherbrooke (Quebec), CANADA J1K 2R1
>> Tel.: (+1 819) 821 8000
>> #61904
>> Fax.: (+1 819) 821 7944
>> Stephane.Poirier at USherbrooke.ca
>> http://www.usherbrooke.ca/cartel
>>
>> P.S.:
>>
>> //works fine
>> defaultBounds=new
>> OpenLayers.Bounds(-180, 5, -10, 85); //north america
>> var myepsg="EPSG:4326";
>> //working with google, nasa, metacarta, etc.)
>>
>> //works
>> fine
>> //BBOX=-2750564.75,-936638.5,3583872.5,4673125 //for
>> canada
>> defaultBounds=new
>> OpenLayers.Bounds(-2750564.75,-936638.5,3583872.5,4673125); //north
>> america
>> var myepsg="EPSG:42304"; //Lambert Conic Conformal, working with http://atlas.gc.ca/cgi-bin/atlaswms_en
>> var
>> myproj=new OpenLayers.Projection(myepsg);
>>
>> //How to specify northern hemisphere
>> //defaultBounds=new OpenLayers.Bounds(-180, 0,
>> +180, 90); //north hemisphere?
>> defaultBounds=new OpenLayers.Bounds(?, ?,?,?);
>> //north hemisphere
>> var myepsg="EPSG:102018"; //North Pole Stereographic,
>> working with http://atlas.gc.ca/cgi-bin/atlaswms_en
>>
>> var myproj=new OpenLayers.Projection(myepsg);
>>
>>
>>
>>
>>     
>
>   

-- 
   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





More information about the Users mailing list