[OSM-dev] strange OpenLayers longitude and latitude

Christopher Schmidt crschmidt at metacarta.com
Thu Aug 30 23:35:25 BST 2007


On Thu, Aug 30, 2007 at 11:02:59PM +0100, Steve Coast wrote:
> Chris (and openlayers) don't believe in Mercator (every other tile  
> API does), but then Mercator doesn't believe in Chris.

Hm? I'm not sure what you mean? 

OpenLayers certainly supports the Mercator projection -- the homepage of
the OSM project uses OpenLayers, as does Information Freeway, as do
other sites of my own (like http://labs.metacarta.com/osm/), all with
OSM data.

There is documentation in the OpenLayers wiki on how to configure
OpenLayers to use tiles like the OSM tiles (at
http://trac.openlayers.org/wiki/UsingGoogleTileSchema), which would
probably be the right place to start for this functionality. 

> There should be functions in the OSM JS to get you back to lat/lng,  
> it should be relatively simple.

But that isn't the problem here, of course. The problem is making the
map understand that it is projected in the first place...

... which is exactly what
http://trac.openlayers.org/wiki/UsingGoogleTileSchema is about.

Combining that with the mercatorToLonLat function from
http://openstreetmap.org/javascripts/map.js would provide the projected
map with the appropriate tiles and the ability to transform the internal
x/y of the map to degrees latitude / longitude. 

Regards,
-- 
Christopher Schmidt
MetaCarta




More information about the dev mailing list