Introduction and examples: Difference between revisions
(→Basic use: Note that most URLs can be copied and re-used) |
(→API for linking to maps: Assorted updates) |
||
Line 9: | Line 9: | ||
==API for linking to maps== | ==API for linking to maps== | ||
The | The map exposes a URL for linking to particular views based on searches - see [[The Map URL API]] for details. For example: | ||
* http://map.cam.ac.uk/Computing+Service (location of the UCS) | * http://map.cam.ac.uk/Computing+Service (location of the UCS) | ||
Line 16: | Line 16: | ||
* http://map.cam.ac.uk/saint%20johns%20street ('St John's Street', note lower case, 'saint' vs. 'st', omitted apostrophe, and %20 for space) | * http://map.cam.ac.uk/saint%20johns%20street ('St John's Street', note lower case, 'saint' vs. 'st', omitted apostrophe, and %20 for space) | ||
There's an extended search syntax, for example | There's an extended search syntax, for example: | ||
* http://map.cam.ac.uk/?q=dow&partial=partial (everything containing words starting 'dow') | * http://map.cam.ac.uk/?q=dow&partial=partial (everything containing words starting 'dow') | ||
* http://map.cam.ac.uk/?q=saint&filter=college (all colleges with 'saint' in their names, but not roads or anything else) | * http://map.cam.ac.uk/?q=saint&filter=college (all colleges with 'saint' in their names, but not roads or anything else) | ||
You can also produce links based on underlying ''geographic'' OSM identifiers, which are based on University Planon IDs where possible and which identify sites, buildings and entrances: | |||
* http://map.cam.ac.uk/?ref=M038 (The Austin Building - note that's a Planon ID) | * http://map.cam.ac.uk/?ref=M038 (The Austin Building - note that's a Planon ID) | ||
* http://map.cam.ac.uk/?ref=STEDMUNDS019 (St Edmund's building 019 - extended ID scheme for college buildings and those University buildings not covered by Planon) | * http://map.cam.ac.uk/?ref=STEDMUNDS019 (St Edmund's building 019 - extended ID scheme for college buildings and those University buildings not covered by Planon) | ||
There's an [http://map.cam.ac.uk/refbrowser/ interactive browser] (also linked from the 'More...' menu) that you can use to explore the map's geographic database and to to help find these various identifiers. | |||
... | It's also possible to construct links based on institution identifiers, which in turn are based on the 'institution Identifiers' used in [http://www.lookup.cam.ac.uk Lookup]: | ||
* http://map.cam.ac.uk/?inst=CS (the UCS, by INSTID) | * http://map.cam.ac.uk/?inst=CS (the UCS, by INSTID) | ||
If all else fails you can limk to a physical areas: | |||
* http://map.cam.ac.uk/?bb=52.2043,0.11835,52.2025,0.1216 (New Museums Site) | * http://map.cam.ac.uk/?bb=52.2043,0.11835,52.2025,0.1216 (New Museums Site) | ||
Line 40: | Line 40: | ||
* http://map.cam.ac.uk/Hopkinson+Lecture+Theatre#52.199669,0.127349,15 | * http://map.cam.ac.uk/Hopkinson+Lecture+Theatre#52.199669,0.127349,15 | ||
If the fragment is a URL it refrences an annotation ovrlay - see below. Further details of all this are available in [[The Map URL API]]. | |||
==Embedding Maps== | ==Embedding Maps== |
Revision as of 15:32, 25 July 2013
Basic use
- The map 'frontpage': http://map.cam.ac.uk/.
- You can search for most things and once you've found something you'll also get addresses and other contact details.
- Clicking shows a popup menu that, among other things, lets you see what's nearby and can mark a single location on the map.
- The map automatically adapts for display on small-screen devices
- Most views have individual URLs that can be copied and used elsewhere (on web pages, in emails, etc.)
API for linking to maps
The map exposes a URL for linking to particular views based on searches - see The Map URL API for details. For example:
- http://map.cam.ac.uk/Computing+Service (location of the UCS)
- http://map.cam.ac.uk/New+Museums+Site (location of the New Museums Site)
- http://map.cam.ac.uk/saint (everything containing 'saint', multiple hits)
- http://map.cam.ac.uk/saint%20johns%20street ('St John's Street', note lower case, 'saint' vs. 'st', omitted apostrophe, and %20 for space)
There's an extended search syntax, for example:
- http://map.cam.ac.uk/?q=dow&partial=partial (everything containing words starting 'dow')
- http://map.cam.ac.uk/?q=saint&filter=college (all colleges with 'saint' in their names, but not roads or anything else)
You can also produce links based on underlying geographic OSM identifiers, which are based on University Planon IDs where possible and which identify sites, buildings and entrances:
- http://map.cam.ac.uk/?ref=M038 (The Austin Building - note that's a Planon ID)
- http://map.cam.ac.uk/?ref=STEDMUNDS019 (St Edmund's building 019 - extended ID scheme for college buildings and those University buildings not covered by Planon)
There's an interactive browser (also linked from the 'More...' menu) that you can use to explore the map's geographic database and to to help find these various identifiers.
It's also possible to construct links based on institution identifiers, which in turn are based on the 'institution Identifiers' used in Lookup:
- http://map.cam.ac.uk/?inst=CS (the UCS, by INSTID)
If all else fails you can limk to a physical areas:
- http://map.cam.ac.uk/?bb=52.2043,0.11835,52.2025,0.1216 (New Museums Site)
Map URLs can also have a fragment part consisting of a hash followed by further information. The fragment part comprises either one to five numbers, or another URL. The numbers control where the map is displayed initially - for example here's a map showing the Hopkinson Lecture Theatre but scaled and centred to also show the station:
If the fragment is a URL it refrences an annotation ovrlay - see below. Further details of all this are available in The Map URL API.
Embedding Maps
All of the URL's above can be used as the source for an iframe to embed the corresponding map in a particular page - see The Embedding API for details.
For example this:
<!DOCTYPE html> <html> <head> <title>Iframe test</title> <style type="text/css"> #map { width: 400px; height: 400px; border: 1px solid black; } </style> </head> <body> <iframe id="map" src="http://map.cam.ac.uk/Computing+Service"> </iframe> </body> </html>
Produces a page like this.
Here's a further example: the normal UCS 'Where we are' page uses the map embedded in an <iframe>.
Tile API
The tiles making up the map are freely available - see The Tile API.
Here are some of the tiles that make up the city centre.
They follow the conventions of OpenStreetMap and other similar systems and so can be consumed in various ways. Here are some examples using third-party map APIs:
- An example displaying our tiles, OSM's, or Google's using OpenLayers.
- An example with marker and shape overlay using Leaflet
- A further example combining our tiles and Google's, this time using the Google Maps API
Index API
There's an API for accessing the data in the map's index - see The Database API. It uses similar queries to those used to draw and embed maps and returns results in JSON format. To ease experimentation you can add '&debug=1' to all index API queries to have results displayed in a browser rather than exported as JSON files. Here are some examples based on the map URLs above:
- http://map.cam.ac.uk/v5.json?q=Computing+Service (debug version)
- http://map.cam.ac.uk/v5.json?q=New+Museums+Site (debug version)
- http://map.cam.ac.uk/v5.json?q=saint (debug version)
- http://map.cam.ac.uk/v5.json?q=saint%20johns%20street (debug version)
- http://map.cam.ac.uk/v5.json?q=dow&partial=partial (debug version)
- http://map.cam.ac.uk/v5.json?q=saint&filter=college (debug version)
- http://map.cam.ac.uk/v5.json?ref=M038 (debug version)
- http://map.cam.ac.uk/v5.json?ref=STEDMUNDS019 (debug version)
- http://map.cam.ac.uk/v5.json?inst=CS (debug version)
- http://map.cam.ac.uk/v5.json?bb=52.2021,0.1184,52.2047,0.1218 (debug version)
- http://map.cam.ac.uk/v5.json?alpha=a (debug version)