[OpenLayers-Users] Pre-seeding localStorage
Mario Danelli
mario.danelli at gmail.com
Thu May 9 02:28:08 PDT 2013
Dear Jurrie,
> The only thing is that my bounds are in Spherical Mercator, and not in
> WGS84 Datum.
> Thus, the calculations would be somewhat different.
> Maybe you know a similar example with Spherical Mercator?
To do that you have to transform the coordinates with some code similar to
the below lines:
------------------------- BEGIN
var toProjection = new OpenLayers.Projection("EPSG:4326"); // transform TO
WGS 1984
var fromProjection = new OpenLayers.Projection("EPSG:900913"); // transform
FROM Spherical Mercator Projection
var bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(lon_start,
lat_start).transform(fromProjection, toProjection)); //SEE TRANSFORM METHOD
bounds.extend(new OpenLayers.LonLat(lon_stop,
lat_stop).transform(fromProjection, toProjection)); //SEE TRANSFORM METHOD
------------------------- END
Regards
Mario Danelli
More information about the Users
mailing list