[OpenLayers-Users] Is there an example of using layers with differing source projections.. ie using Proj4?

Mike Adair madair at dmsolutions.ca
Thu Feb 14 09:28:08 EST 2008


Lance,

That kind of thing is being taken care of inside of OpenLayers 
development, where feature coordinates get automatically transformed to 
the map coordinate system.  I'm not sure how far along that work has 
progressed though.

Mike


Lance Dyas wrote:
> The example usage I am thinking of is where I have a WFS layer of one 
> projection and mayhaps a WMS of another.. WFS 1.0 seem inclined to 
> answer in whatever projection they have... I think it is in 1.1 that 
> you are better able to specify you want the layer in a specific 
> projection..and actually get it in that projection.
>
> Mike Adair wrote:
>> An example that doesn't do much but demonstrates how to include 
>> Proj4js and use the OpenLayers objects to do coordinate transformations:
>>
>> <script src="../lib/OpenLayers.js" type="text/javascript"></script>
>> <script src="../lib/proj4js/proj4js-compressed.js" 
>> type="text/javascript"></script>
>>
>> <script type="text/javascript">
>> Proj4js.defs["EPSG:3003"] = "+title=Gauss Boaga EPSG:3003 +proj=tmerc 
>> +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl 
>> +units=m  +no_defs";
>>
>>  function init() {
>>    var point = new OpenLayers.Geometry.Point(9.5, 30.0);
>>    var src = new OpenLayers.Projection('EPSG:4326');
>>    var dest = new OpenLayers.Projection('EPSG:3003');
>>    OpenLayers.Projection.transform(point, src, dest);
>>    alert('coordinates transformed:'+point.toString());
>>  }
>>  window.onload = init;
>> </script>
>>
>> The point to be transformed is any object that has  .x and  .y 
>> properties.
>>
>> Mike
>>
>>
>>
>> Lance Dyas wrote:
>>> Mike Adair wrote:
>>>  
>>>> EPSG:3003 uses a tmerc projection and is supported by Proj4js.  Did 
>>>> you remember to include the Proj4js library with a script tag in 
>>>> your application?
>>>>
>>>> Mike
>>>>
>>>>     
>>>
>>
>>
>
>



More information about the Users mailing list