Discussion:
[Viking-devel] Possible bug in scaling
Szymon
2015-09-27 18:59:31 UTC
Permalink
Hi,

I found some strange behaviour of Viking.

When I zoom out as much as possible and move map up and down, then scale
label at the bottom of map increase and decrease. I expect that
direction of this changes should switch on equator, but it isn't. It is
about N 70. When I zoom in, border of changes goes to equator.

Also, when I'm moving cursor to south, value on status bar skips from
about S 79 to N 10.

Does someone observe something that?

BR,
Szymon

------------------------------------------------------------------------------
Robert Norris
2015-11-17 22:56:38 UTC
Permalink
---------------------------------------
Date: Sun, 27 Sep 2015 20:59:31 +0200
Subject: [Viking-devel] Possible bug in scaling
Hi,
I found some strange behaviour of Viking.
When I zoom out as much as possible and move map up and down, then scale
label at the bottom of map increase and decrease. I expect that
direction of this changes should switch on equator, but it isn't. It is
about N 70. When I zoom in, border of changes goes to equator.
Also, when I'm moving cursor to south, value on status bar skips from
about S 79 to N 10.
Does someone observe something that?
Sorry for the delay in replying, I had originally typed a longish reply which I subsequently lost.

Yes this is what one observes.

This could be considered an artefact of how Viking is drawing the scale bar and also to some extent the cursor position reading.

Primarily these are due to the projection used to draw the Earth's sphere on to a 2D surface, as such Viking defaults to using a Mercator projection (as per Google Maps + OSM).

See https://en.wikipedia.org/wiki/Web_Mercator

The projection holds true until about +/-85N/S (as it expands to infinity at the poles). Viking makes no attempt to limit the display to between these limits and so the cursor position values wrap around. (My impression that the mathematics works between +/-80N/S - which is what is observed in Viking's cursor readout).

Given that very few people live outside the 80N <-> 80S this is not too much of a problem for general usage of Viking.

This leads on the scale bar. The scale is actually only applicable to the current latitude - thus for areas covering typical walk/cycle activities or viewing a country the scale will be accurate. However when zoomed out to see whole continents or more where the view covers 10's of degrees of latitude the scale is somewhat arbitrary.

In fact Viking in vik_viewport_draw_scale() uses the latitude of the bottom of the screen (i.e. close to where the scale bar is drawn), hence causing the scroll bar to resize when it does when one moves the map.

I suspect you expect the scale to use the centre latitude of the map - which to be fair makes more sense - and I agree.

Try changing these in vikviewport.c:
vik_viewport_screen_to_coord ( vvp, 0, vvp->height, &left );
vik_viewport_screen_to_coord ( vvp, vvp->width/SCSIZE, vvp->height, &right );
to -->
vik_viewport_screen_to_coord ( vvp, 0, vvp->height/2, &left );
vik_viewport_screen_to_coord ( vvp, vvp->width/SCSIZE, vvp->height/2, &right );

I think I will commit this change.
BR,
Szymon
------------------------------------------------------------------------------
_______________________________________________
Viking-devel mailing list
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/
Loading...