Difference between revisions of "Introduction and examples"

From University Map Wiki
Jump to navigationJump to search
(Raven restriction removed so remove coresponding warnings)
Line 33: Line 33:
  
 
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.  
 
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.  
 
''These examples use tiles from http://map.cam.ac.uk/ - because it currently requires Raven authentication they won't work properly until you've authenticated (once) to map.cam.ac.uk.''
 
  
 
For example this:
 
For example this:
Line 68: Line 66:
  
 
The tiles making up the map are freely available - see [[The Tile API]].  
 
The tiles making up the map are freely available - see [[The Tile API]].  
 
''These examples use tiles from http://map.cam.ac.uk/ - because it currently requires Raven authentication they won't work properly until you've authenticated (once) to map.cam.ac.uk.''
 
  
 
Here are [http://webtools.csx.cam.ac.uk/map-demo/tiles.html some of the tiles that make up the city centre].
 
Here are [http://webtools.csx.cam.ac.uk/map-demo/tiles.html some of the tiles that make up the city centre].

Revision as of 07:48, 4 July 2012

Basic use

API for linking to maps

The front page URL exposes a URL for linking to particular views based on searches - see The Map URL API for details. For example:

There's an extended search syntax, for example

...or based on underlying OSM identifiers, which are Planon IDs for University buildings.

...or on map institution identifiers:

...or based on physical areas

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 reworked to use the new map.

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:

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: