[OpenLayers-Users] OpenLayers.Control.ScaleLine accuracy issue

plen peteralen at earthlink.net
Wed Jan 14 14:24:00 EST 2009


Christopher,

Yes, currently I get the viewport bounds via:

var coordArray = map.getBounds().toArray();

>From that I can get the SW and NE viewport coordinates.  This is where the
problem starts.  The first issue was getting the proper distance between the
SW point and the NE point.  This is where I started to see a difference in
the OL distanceTo function (flat map) and another algorithm that determines
distances on a sphere.  I needed to determine the distance in order to
calculate another zoom level's SW & NE coordinates.  This was done by
determining the distance to the next level up (based on the current SW to NE
distance) and determining the bearing.  The second problem was that when the
new SW & NE coordinates were determined, it only worked if the original
distance between the current viewport's SW & NE points was derived using the
algorithm that calculates distance on a sphere.

- Peter
-- 
View this message in context: http://n2.nabble.com/OpenLayers.Control.ScaleLine-accuracy-issue-tp2117980p2158692.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list