Commons:British Library/Mechanical Curator collection/georeferencing campaign/next steps/zoom

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

OSM zoom levels[edit]

Mercator projection between 85°S and 85°N, giving a map that is a square.
Red circles represent equal-sized areas in reality on the ground.
See http://wiki.openstreetmap.org/wiki/Zoom_levels and http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale
Also http://leafletjs.com/examples/zoom-levels/

The primary use of the zoom parameter at OSM is to request the resolution of tiles to be returned by the tile server.

At zoom level zero, a Mercator projection of the whole world (technically, between latitudes 85°S to 85°N) fits into a tile 256 x 256 pixels.

At zoom level one, four such tiles are used, so the world is covered in 512 x 512 pixels.

Thus, given the size in pixels of the complete image required, and the size of the area to be represented, the appropriate zoom-level of tiles can be requested from the server.

Nominatim[edit]

See http://wiki.openstreetmap.org/wiki/Nominatim

Nominatim tries to return an object that is appropriate for a particular zoom level, as per "Leaflet.js/OpenLayers/etc".

"0 is country and 18 is house/building"

Levels as written to Flickr[edit]

The zoom levels as written to Flickr are currently generated by the following code:

my $zoom = int((-log ($range / 360) / log(2)) + 1);
if ($zoom < 0) {$zoom = 0};

where $range is the larger of ($east - $west) or ($north - $south), in degrees.

This is also the zoom level that is passed to Nominatim, and which are tagged to Twitter.

Interpretation[edit]

When ($east - $west) is the larger range, this corresponds to the tileset zoom that would be requested to display the map in a window 512 px wide.

When ($north - $south) is larger, this does not quite correspond to the tileset zoom, because it has ignored the Mercator scaling factor.

The correct comparison would be to expand the ($north - $south) range by a factor 1 / cos ($lat), and then compare whether ($north - $south) / cos ($lat) is larger than ($east - $west)

(Technically, this too is a small-map approximation: for larger maps, the Mercator factor would be even bigger, = (180/π) { ln(tan(45° + ($north/2))) - ln(tan(45° + ($south/2))) } to be compared with the east-west range.

So eg for London (Lat: 51.5° N), the ($east - $west) difference dominates in setting the zoom unless the North-South distance on the map is about 1.6 times larger.

(East-West would probably often dominate anyway, if most maps were "landscape" format; but it means eg in London, the largest map that will be assessed as "zoom 16" will have a range of about 0.01 degrees. That corresponds to 692 m East-West, but 1112 m North-South).

Consideration[edit]

  • Should the North-South number be recalculated, taking into account the correction, and adjusting the zoom level where North-South becomes dominant and exceeds the box.
    • This probably would make the scaling easier to understand.
    • Note that OSM's scale factor (in terms of real distances on the ground) varies with latitude -- on the Equator, "zoom 16" would be anything up to 1112 m, either North-South or East-West.
  • Should the "+1" offset be removed, making the number closer to OSM's ?
    • The notional 512 x 512 px window seems to work quite well for Nominatim.
    • But it may be confusing that 'whole world' maps (which were mostly omitted from the set) are zoom 1 rather than zoom 0.