[OpenLayers-Users] Reproject vectordata with OL 2.5 and proj4js

Xin xin at zenpow.com
Wed Mar 26 07:31:52 EDT 2008


Did you know projection is in built into OpenLayers trunk?

see
http://www.nabble.com/KML-and-Popup-window-problem-to16007328.html#a16007328



On 24/03/2008, Arnd Wippermann <arnd.wippermann at web.de> wrote:
>
> Hi,
>
> What is the right way to reproject vectordata with proj4js?
>
> I'm using OL 2.5 with proj4js and want reproject vector-files (KML, GML,
> etc.), when I add these files on the fly into a map with a different
> projection. I have managed this for tests, that I have patched the
> Point.js.
>
>         if(fromProjection!=toProjection)
>         {
>             var csFrom = projHash[fromProjection];
>             var csTo   = projHash[toProjection];
>
>             var p = new Proj4js.Point(parseFloat(x),parseFloat(y));
>             Proj4js.transform(csFrom, csTo, p);
>
>             this.x = p.x;
>             this.y = p.y;
>         }
>         else
>         {
>             this.x = parseFloat(x);
>             this.y = parseFloat(y);
>         }
>
> and also for the vector formats the function buildCoordinatesNode. It
> works,
> but I hope there is better way to do this.
>
> As a side effect I experienced WFS-layers are reprojected, when the BBOX
> of
> the actual map projection (toProjection) have values, that match the
> fromProjection as well.
>
> Is there clean way to reproject WFS-layers?
>
>
> Mit freundlichen Grüssen
>
> Arnd Wippermann
> http://gis.ibbeck.de/
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080326/53f487f7/attachment.html


More information about the Users mailing list