[OpenLayers-Users] scaleline in lon/lat projection

Jan Burdziej jab at umk.pl
Fri Apr 30 08:02:01 EDT 2010


Hi Andreas,

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
>
I have applied your patch and now it works great. Thanks a lot for your kind
support!



> > 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.
>
Ok, now I get the point. Although if you think of converting degrees to
inches or meters I would still argue it is not a constant...



> 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.
>
I was using the latitude of a map center to get the length of the given
parallel in inches and than I was updating OpenLayers.INCHES_PER_UNIT. It
seemed that the scale line control "listened" to these updates as it was
adjusting itself when moving in N-S direction. Since parallels have W-E
direction, so in fact the result was the same as in your patch, despite
possibilities of breaking some other measurements and calculations which
were using OpenLayers.INCHES_PER_UNIT.
I understand that there are differences in W-E and N-S measurements and I
agree that W-E usually makes more sense for the scale line (as scale line is
horizontal). Although scaleline in both directions (kind of a scaleCross ???
could be an interesting approach...)
Another thing I would consider is calculating W-E Vincenty distance not in
the center of a map but in the bottom of a map, where the scaleline is
usually placed. Usually (probably?) when users want to use scaleline to
measure distance they pan the map so that the scaleline fits the measured
object. In other words, scaleline could (???) be placed where it is more
correct... But this is just and idea. On the other hand this will cause
bigger errors for applying this scaleline to the upper parts of the map. I
understand that each solution has its own pros and cons.



> 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.
>
Right.


>  > 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.
>
Hmm, so I must be doing something wrong. Having applied your patch and
having set both scaleline and scale controls to geodesic: true these work
fine now. But the scaleline attached to a PDF generated with GeoServer PDF
printing module still shows a wrong scale line. Or is it because I use
GeoServer PDF instead of the source MapFish...?


Regards,
Jan Burdziej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100430/ba017b77/attachment.html


More information about the Users mailing list