Difference between revisions of "The Map URL API"

From University Map Wiki
Jump to navigationJump to search
(remove zoom on bb)
Line 133: Line 133:
 
</td>
 
</td>
 
<td style="vertical-align: top; ">
 
<td style="vertical-align: top; ">
http://map.cam.ac.uk/?bb=52.2021,0.1184,52.2047,0.1218&amp;z=19</td>
+
http://map.cam.ac.uk/?bb=52.2021,0.1184,52.2047,0.1218</td>
 
</tr>
 
</tr>
 
</table>
 
</table>

Revision as of 10:56, 24 October 2012

URLs have the following structure. Note that in all cases where a query string follows a directory the separating '/' is optional (i.e. http://map.cam.ac.uk/x/?q=s is exactly the same as http://map.cam.ac.uk/x?q=s).

URL Description Examples
http://map.cam.ac.uk/ displays the home page of the University map http://map.cam.ac.uk/
http://map.cam.ac.uk/name

displays the map homed in on the item called name. name is URL encoded text for any entity the map can locate, ignoring case and punctuation and including any synonymous forms (such as Road vs. Rd). In fact this is simply an neater abbreviation for 'http://map.cam.ac.uk/?q=name' (see below).

If you want to link to a map on the centrally hosted site, this is the best kind of URL to use. But consider embedding a map: see below.

Older names will still respond to searches providing a cross reference is included in the database (as it was in the older system), or the old name is present in the 'AKA' field.

http://map.cam.ac.uk/Lucy+Cavendish+College

http://map.cam.ac.uk/austin%20building

http://map.cam.ac.uk/Fenner%27s

http://map.cam.ac.uk/Tennis+Court+Road

http://map.cam.ac.uk/fitzwilliam+st

http://map.cam.ac.uk/queens+college
(note the absence of apostrophe).

http://map.cam.ac.uk/?ref=ref displays the map homed in on the item(s) referenced ref. References are geographical information and refer to entrances, buildings and sites/colleges as indicated by the ref=... tag on the corresponding OpenStreetMap data. ref can also be a list of references separated by '|' (up to 25 can be requested at once). Where buildings or sites are selected the corresponding main entrances are also displayed.

http://map.cam.ac.uk/?ref=STEDMUNDS019
(which is the Library building in St Edmund's College)

http://map.cam.ac.uk/?ref=WOLFSON--W
(Wolfson College W staircase)
 

http://map.cam.ac.uk/?inst=inst displays the map homed in on institution(s) identified by inst, the institution code, which is case insensitive, or a list of these separated by '|' (up to 25 can be requested at once).

http://map.cam.ac.uk/?inst=CS
(computing service)

http://map.cam.ac.uk/?inst=cs
(ditto)

http://map.cam.ac.uk/?inst=lcc
(Lucy Cavendish College)

http://map.cam.ac.uk/?inst=lucy-cav%7Cjoh
(lucy Cavendish and St John's Colleges)

http://map.cam.ac.uk/?q=search
[&one=list]
[&partial=yes]

[&filter=filter]

displays the map page with results of the search for the URL encoded string search. Multiple search strings may be given separated by '|'

'one=list' is optional and if given overrides the default behaviour (which is to display the single result) and instead to display it as a list of results comrpsing only a single entry.

If 'partial=yes' (or in fact, 'partial=anything else') is given results returned by the search are interpreted as a partial search, that is in the same way as typing the first few letters of a word (the last word if more than one). If not present then a match is made only on whole words (including synonymous forms and ignoring case and punctuation, but in any order).

Note that as a special case for non-partial searches, if a match is found on a phrase which also has a longer phrase in which the same words appear, only the single shorter result is supplied. For example 'Austin+Building' does not return 'Austin Robinson Building'.

If filter is given, only results which match the filter are returned. filter is one or more of the following, separated by vertical bar, for example "filter=college|academic": college, academic, site, nonacademic, lecture, techno, street, nonuniversity.

Note that if the search yields only one result and the optional parameters are omitted, then the result is identical to the URL http://map.cam.ac.uk/name as above.

http://map.cam.ac.uk/?q=Lucy+Cavendish+College

http://map.cam.ac.uk/?q=lucy%7Cqueens

http://map.cam.ac.uk/?q=Wolfson+College&one=list

http://map.cam.ac.uk/?q=Do&partial=yes
(which might yield results for Downing College, Downing Street, Downing Place, Downing Site and Doubletree by Hilton).

http://map.cam.ac.uk/?q=Do
(produces no results)

http://map.cam.ac.uk/?q=sussex&filter=college

http://map.cam.ac.uk/?bb=lat0,lon0,lat1,lon1
[&one=list]
[&filter=filter]

search by bounding box (specified as a pair of latitude/longitude co-ordinates) rather than text string. Note: no spaces after commas. Large bounding boxes can produce very large amounts of data, so please keep areas small (say < 500m).

filter as above

http://map.cam.ac.uk/?bb=52.2021,0.1184,52.2047,0.1218