[OSM-dev] OpenLayers problem with latitude and longitude placement

Maarten Deen mdeen at xs4all.nl
Sun Dec 7 14:25:11 GMT 2008


Ulf Lamping wrote:
> Maarten Deen schrieb:
>> Are there any OpenLayers experts here?
>> 
>> I'm trying to draw lines on a map using plain latitude and longitude 
>> coordinates. So that I can use (0,0) for the equator and (0, 51) for some point 
>> on the Greenwich meridian in England.
>> 
>> But I can't find out how to do it.
>> I have an example at <http://www.maasluip.nl/ebt/test.html>
>> I make the lines in a loop at line 52. I almost thought "nice, it's degrees * 
>> 111320", but that doesn't add up at higher latitudes.
>> 
>> I understood the maxExtent in the projection to be the way to control this, but 
>> apparently it isn't (as I have the map created with maxExtent: new 
>> OpenLayers.Bounds(-180,-90,180,90))
>> 
>> Any ideas?
> 
> No expert here, but I'm currently playing around with OSM myself.
> 
> I guess it's better to use the LonLat.transform function.

Yes, that does the trick.

It's not flawless, the lines disappear from zoom 13 and deeper. I guess that's 
some OpenLayers bug.

Maarten




More information about the dev mailing list