[OpenLayers-Dev] LonLat to place marker.
Christopher Schmidt
crschmidt at metacarta.com
Mon Sep 7 17:10:26 EDT 2009
On Mon, Sep 07, 2009 at 06:33:47PM +0100, Richard Ive wrote:
> Hey.
>
>
> I've got a script that calculates the lon & lat of a OS Grid Reference.
>
> The function returns an OpenLayers.LonLat object as follows:
> lon=51.499435634436,lat=-0.21041620665612
>
> If you put that into google maps (in reverse order as google accepts lat
> long) it's position is correct.
>
> However if I do :
>
> lonLat = OSGridToLatLong(osGrid);
> driver.addMarker(new OpenLayers.Marker(lonLat,icon));
>
> The marker appears 1000's of miles directly south of where it should be.
>
> Has anyone any idea why this may be happening?
My guess is that youre using an OSM map or a spherical mercator ap.
In that case, you need to reproject your lonlat.
http://docs.openlayers.org/library/spherical_mercator.html
> Thanks.
>
> --
> Regards,
> Richard Ive.
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
--
Christopher Schmidt
MetaCarta
More information about the Dev
mailing list