The Tile API: Difference between revisions

From University Map Wiki
Jump to navigationJump to search
(Addd credit section)
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
Please read [[Terms and conditions, Copyright, Fair Use, etc.]] if you are going to use this API.
The map is assembled from a grid of image "tiles", each a 256x256 pixel PNG format image representing a small portion of the map in [http://en.wikipedia.org/wiki/Mercator_projection spherical Mercator projection]. This is so that as it is panned, images can be loaded or dropped to keep them relevant to the area on view and therefore keep browser memory, bandwidth and download times under control. There is a separate set of tiles for each zoom level. Each higher zoom level doubles the scale and quadruples the number of tiles needed to represent the same area.
The map is assembled from a grid of image "tiles", each a 256x256 pixel PNG format image representing a small portion of the map in [http://en.wikipedia.org/wiki/Mercator_projection spherical Mercator projection]. This is so that as it is panned, images can be loaded or dropped to keep them relevant to the area on view and therefore keep browser memory, bandwidth and download times under control. There is a separate set of tiles for each zoom level. Each higher zoom level doubles the scale and quadruples the number of tiles needed to represent the same area.


Line 59: Line 61:
</table>
</table>


Map tiles can be retrieved using URLs thus:
Map tiles are retrieved using URLs thus:


   <nowiki>http://map.cam.ac.uk/tiles/</nowiki>''z''/''x''/''y''.png
   <nowiki>https://map.cam.ac.uk/tiles/</nowiki>''z''/''x''/''y''.png


where&nbsp;
where&nbsp;
Line 68: Line 70:
* y is the tile number in the north/south direction
* y is the tile number in the north/south direction


This is a [http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames conventional form] adopted among others by OpenStreetMap for tile presentation. That page also gives the formulae for converting between latitude/longitude and tile number. Rather than managing tiles directly, one could instead present the map itself using an IFRAME as described in [[The Embedding API ]] and the search/text information in a custom form using the [[The Database API]]. The same form of URL is also used by [http://openlayers.org OpenLayers] (amongst other interfaces) to display maps; most such interfaces let you plug in the prefix part of the url so that tiles can be obtained from arbitrary sources, and the URLs above are compatible with that. &nbsp;It is also possible to overlay information on the tiles obtained from OpenStreetMap&#39;s tile server or even on a Google map (whose tiles also use the same projection and numbering scheme).
This is a [http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames conventional form] adopted among others by OpenStreetMap for tile presentation. That page also gives the formulae for converting between latitude/longitude and tile number. Rather than managing tiles directly, one could instead present the map itself using an IFRAME as described in [[The Embedding API ]] and the search/text information in a custom form using the [[The Database API]]. The same form of URL is also used by [http://openlayers.org OpenLayers] (amongst other interfaces) to display maps; most such interfaces let you plug in the prefix part of the url so that tiles can be obtained from arbitrary sources, and the URLs above are compatible with that. &nbsp;It is also possible to overlay information on the tiles obtained from OpenStreetMap&#39;s tile server or even on a Google map (whose tiles also use the same projection and numbering scheme). In addition, these tiles can be used with stand-alone programs that expect the OpenStreetMap conventions - for example they have been used with both [https://itunes.apple.com/gb/app/openmaps/id359719250?mt=8 OpenMaps] and [https://itunes.apple.com/gb/app/globalscout/id395216691?mt=8 GlobalScout] under iOS.
 
==Credits==
 
These tiles are generated from information provided by [http://www.openstreetmap.org/ OpenStreetMap]. The [http://wiki.openstreetmap.org/wiki/OpenStreetMap_License OpenStreetMap licence] allows this data for be reused in this way, but requires that OpenStreetMap is credited and that it is make it clear that the maps are available under OSM's licence terms. See [http://wiki.openstreetmap.org/wiki/Legal_FAQ#I_would_like_to_use_OpenStreetMap_maps._How_should_I_credit_you.3F the OSM legal FAQ] for guidance on how to achieve this.
 
In addition, please credit the University of Cambridge and its Computing Service for providing the tiles. This is in your interest, because it will help to ensure that resources continue to be available to support the map system. We suggest "Map tiles from the University of Cambridge Official Map, provided and managed by the University Computing Service". Where appropriate, please link 'University of Cambridge Official Map' to http://map.cam.ac.uk/ and 'University Computing Service' to http://www.ucs.cam.ac.uk/.

Latest revision as of 22:43, 20 October 2017

Please read Terms and conditions, Copyright, Fair Use, etc. if you are going to use this API.

The map is assembled from a grid of image "tiles", each a 256x256 pixel PNG format image representing a small portion of the map in spherical Mercator projection. This is so that as it is panned, images can be loaded or dropped to keep them relevant to the area on view and therefore keep browser memory, bandwidth and download times under control. There is a separate set of tiles for each zoom level. Each higher zoom level doubles the scale and quadruples the number of tiles needed to represent the same area.

While in principle we could use zoom levels from 1, the whole world, to a very large number, in practice the tiles for the University are only generated for levels 13 to 19, so the user should be constrained from going beyond these limits (zoom 19 is equivalent to a scale of about 1 tile to 46m, 0.18m per pixel or 0.66m per mm on a typical display).

Similarly, we don't store tiles for the whole world. We only store an area about 8km square for each zoom level centred on western Cambridge covering most of the University's estate:

  latitude / longitude tile number at zoom 13 tile number at zoom 19
west -0.0025440 4086 262141
east 0.1767487 4099 262401
north 52.2419705 2697 172607
south 52.1594374 2699 172802

Map tiles are retrieved using URLs thus:

 https://map.cam.ac.uk/tiles/z/x/y.png

where 

  • z is the zoom level
  • x is the tile number in the east/west direction
  • y is the tile number in the north/south direction

This is a conventional form adopted among others by OpenStreetMap for tile presentation. That page also gives the formulae for converting between latitude/longitude and tile number. Rather than managing tiles directly, one could instead present the map itself using an IFRAME as described in The Embedding API and the search/text information in a custom form using the The Database API. The same form of URL is also used by OpenLayers (amongst other interfaces) to display maps; most such interfaces let you plug in the prefix part of the url so that tiles can be obtained from arbitrary sources, and the URLs above are compatible with that.  It is also possible to overlay information on the tiles obtained from OpenStreetMap's tile server or even on a Google map (whose tiles also use the same projection and numbering scheme). In addition, these tiles can be used with stand-alone programs that expect the OpenStreetMap conventions - for example they have been used with both OpenMaps and GlobalScout under iOS.