[OpenLayers-Users] scaleline in lon/lat projection

Andreas Hocevar ahocevar at opengeo.org
Thu Apr 29 06:37:28 EDT 2010


On Apr 29, 2010, at 10:21 , Jan Burdziej wrote:

> Hi,
> I have created a ticket at: http://trac.openlayers.org/ticket/2600. I hope I did it correctly, as it was my first ticket :)
> 
> However, I still have a problem with ScaleLine on WGS84-based map. Below I attach a complete html file with a map. In this example when I zoom in to Europe and pan from N to S the ScaleLine does not change. Unless I move to the pole, but this was discussed earlier and a ticket for this has been created. 

With the new patch I attached to #1890, you should see the behavior you would expect. The reason is that we now measure in W-E direction, which makes more sense for most projections

> My questions are also: 
> 1. What do you think about updating OpenLayers.INCHES_PER_UNIT instead of calculating N-S or W-E geodesic distances for calibrating the scale line control.

See the discussion in #2600. My new patch adds a getGeodesicPixelSize method to the map. Width and height of the geodesic measurement of this pixel will be different. OpenLayers.INCHES_PER_UNIT is a global constant which should not be changed, because it is just there to convert between different units.

How would you calibrate the scaleline with your approach? There will still be a difference in measuring your unit in N-S and W-E direction on the map, especially in EPSG:4326. And the distance will also be different at every pixel on the map. I think that using a W-E measurement can be justified because we display the scaleline as horizontal line, which is W-E in most common projections. But still - if you zoom out far, the scaleline will only be accurate around the center of the map viewport.

Note that our geodesic measurement of distances (Vincenty) measures the distance between two coordinates on an ellipsoid, instead of the map. Applying this to ScaleLine and Scale means that instead of using the map resolution (which is map units per pixel), we use the ellipsoid distance of a pixel edge.

> 2. If you apply a patch that changes the scale line control to do a West-East measurement instead what will happen if you drag your map beyond -180/180 longitudes?

Vincenty works fine in that case.

> 3. Do you have any idea whether MapFish will also adopt geodesic scale bar functionality?

MapFish uses OpenLayers, so it is just a matter of using the geodesic option.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list