[OpenLayers-Users] Is there an example of using layers with
differing source projections.. ie using Proj4?
Lance Dyas
lancelot at inetnebr.com
Wed Feb 13 22:09:15 EST 2008
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