[OpenLayers-Users] reprojection of vector layer from wgs84
to sphericalmercator
Jachym Cepicky
jachym.cepicky at gmail.com
Mon Jan 14 09:56:05 EST 2008
Hi,
Jachym Cepicky píše v Po 14. 01. 2008 v 14:11 +0100:
> [...]
>
> Then I tried to redefine preFeatureInsert method of OpenLayers.Layer.Vector, to get coordinates
> for all features in epsg:900913
>
> preFeatureInsert = function(feature) {
> for (var i = 0; i < feature.geometry.components.length; i++) {
> var x = feature.geometry.components[i].x;
> var y = feature.geometry.components[i].y;
> var ll = kolo.forwardMercator(x,y);
>
> x = x * 20037508.34 / 180;
> y = Math.log(Math.tan((90 + y) * Math.PI / 360)) / (Math.PI / 180);
>
> y = y * 20037508.34 / 180;
>
> feature.geometry.components[i].x = x;
> feature.geometry.components[i].y = y;
>
> }
> };
>
> // the vector map definition
>
> var vector = new OpenLayers.Layer.GML("Vector","gml.xml",
> {preFeatureInsert:preFeatureInsert});
>
this works. the error was somewhere else
j
--
Jachym Cepicky
e-mail: jachym.cepicky at gmail.com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?=
=?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?=
=?ISO-8859-1?Q?_zpr=E1vy?=
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080114/b139b71b/attachment.bin
More information about the Users
mailing list