Unlock

Please fill in a short survey about this website | Contact Us envelope image
Home > Unlock Places > Example Queries

Example Queries

To try out any of the example queries below simply click on the query icon next to the query description. Links open in a new window. For example queries using the Old English place names gazetteer click here: DEEP in Unlock Places

Search by name

search The most basic query is the name search, which will return a list of matching features:

            http://unlock.edina.ac.uk/ws/search?name=Edinburgh
            

search Search for the name 'Edinburgh' from the OS gazatteer and format the results as XML:

http://unlock.edina.ac.uk/ws/search?name=Edinburgh&gazetteer=os&format=xml
            

search Search for the names 'Edinburgh' & 'Glasgow' from the OS and GeoNames gazetteers and format the results as GeoJSON:

http://unlock.edina.ac.uk/ws/search?name=Edinburgh,Glasgow&gazetteer=os,%20geonames&format=json
            

search Search for 'Edinburgh' and output results with spatial reference system 900913 (Web Mercator):

http://unlock.edina.ac.uk/ws/search?name=Edinburgh&srs=900913
            

Search by Unlock identifier

search Search on the Unlock feature identifier 9656 (Edinburgh):

            http://unlock.edina.ac.uk/ws/search?name=9656
            

Search by Gazetteer identifier

search To search on an original gazetteer id (not the Unlock ID), the gazetteer needs to be specified. In this case the search is for the OS feature identifier 81365:

            http://unlock.edina.ac.uk/ws/search?name=81365&gazetteer=os&format=xml
            

Limit results to featureType

search Search for the names 'Edinburgh' & 'Glasgow' with feature type 'cities' and format the results as XML:

http://unlock.edina.ac.uk/ws/search?name=Edinburgh,Glasgow&featureType=cities&format=xml
            

Q:Where are these feature types coming from?
A: You can see the whole list of supported feature types. They are a mix of feature type codes derived from the Alexandria Digital Gazetteer, enhanced to fit Ordnance Survey data sources, and also geonames.org feature types.

Feature types seem most useful when you've already found a feature and want to find other ones like it.

search Search for the names 'Edinburgh' & 'Glasgow' with feature type 'cities'. Set childTypes=true so we include feature subtypes and format results as XML:

http://unlock.edina.ac.uk/ws/search?name=Edinburgh,Glasgow&featureType=cities&format=xml&childTypes=true
            

Limit results to country

search Search for the name 'Edinburgh' in country UK and format the results as XML:

http://unlock.edina.ac.uk/ws/search?name=Edinburgh&country=UK&format=xml
            

search Alternatively, the country value can be included in the name parameter, e.g search for the name 'Edinburgh, UK' and format the results as XML:

http://unlock.edina.ac.uk/ws/search?name=Edinburgh,UK&format=xml
            

Search for a postcode

search Search for the post code 'EH9 1PR' from the Unlock gazetteer and format the results as Comma-separated Text:

http://unlock.edina.ac.uk/ws/search?name=EH91PR&format=txt
            

Search within a bounding box

You can use an arbitrary bounding box (top left and bottom right coordinates) to limit the results of searches to places found within the box.

search Search for the name 'Craiglockhart' within Edinburgh's bounding box, from the OS gazetteer and format the results as XML:

http://unlock.edina.ac.uk/ws/search?name=Craiglockhart&minx=-3.354&miny=55.872&maxx=-3.010&maxy=55.993&operator=within&gazetteer=os
            

search Search for the names 'Portobello' & 'Musselburgh' within Edinburgh's bounding box, from GeoNames gazetteer and format the results as JSON:

http://unlock.edina.ac.uk/ws/search?name=Portobello,Musselburgh&minx=-3.354&miny=55.872&maxx=-3.010&maxy=55.993&format=json&operator=within&gazetteer=geonames
            

search Search for the name 'Craiglockhart' intersecting Edinburgh's bounding box, from the OS gazetteer and format the results as KML:

http://unlock.edina.ac.uk/ws/search?name=Craiglockhart&minx=-3.354&miny=55.872&maxx=-3.010&maxy=55.993&operator=intersect&format=kml&gazetteer=os
            

search Search for all villages within the Edinburgh bounding box and return the results as html:

http://unlock.edina.ac.uk/ws/search?featureType=village*&minx=-3.354&miny=55.872&maxx=-3.010&maxy=55.993&gazetteer=os&format=html
            

Search within a spatialMask

search Instead of explicitly specifying the bounding box of Edinburgh as above, you can instead search using the Unlock ID (spatialMask) of Edinburgh (9656) to get the same results:

http://unlock.edina.ac.uk/ws/search?featureType=village*&gazetteer=os&spatialMask=9656&format=html
            

search Search for all villages intersecting Edinburgh's bounding box, from the OS gazetteer:

http://unlock.edina.ac.uk/ws/search?featureType=village*&gazetteer=os&spatialMask=9656&operator=intersect
            

search Using the realSpatial parameter allows you to specify that the search should use the real detail of the shape, rather than just using the bounding box the shape is contained within:

http://unlock.edina.ac.uk/ws/search?featureType=village*&gazetteer=os&spatialMask=9656&format=html&realSpatial=yes
            

Search using a bounding box and a spatialMask

search Search for all stations within the bounding box of Edinburgh and the Unlock ID of 1141 (which corresponds to the bounding box of Livingston) using the GeoNames gazetteer:

http://unlock.edina.ac.uk/ws/search?&minx=-3.354&miny=55.872&maxx=-3.010&maxy=55.993&operator=within&gazetteer=geonames&featureType=station&spatialMask=11411
            

Search using a buffer

search Using the buffer parameter allows you to search for features within a specified distance (in metres) of an Unlock ID:

http://unlock.edina.ac.uk/ws/search?featureType=village*&gazetteer=os&spatialMask=9656&operator=within&buffer=1000
            

footprintLookup

search Retrieve the footprint for Edinburgh (identifer 9656) from the OS gazetteer and format the results as GeoRSS:

http://unlock.edina.ac.uk/ws/footprintLookup?identifier=9656&gazetteer=os&format=georss
            

search Retrieve the footprints for Edinburgh & Glasgow, from the GeoNames gazetteer and format the results as GeoJSON:

http://unlock.edina.ac.uk/ws/footprintLookup?identifier=5823266,5823268&gazetteer=geonames&format=json
            

search Retrieve the footprint for Edinburgh with results in spatial reference system 27700 (National Grid):

http://unlock.edina.ac.uk/ws/footprintLookup?identifier=9656&srs=27700
            

supportedFeatureTypes

search Note: The supportedFeatureTypes web service only accepts xml, json and txt format parameters:

http://unlock.edina.ac.uk/ws/supportedFeatureTypes?&gazetteer=os,geonames&format=xml
            

closestMatchSearch

search Search for the closest match for 'Edinburgh' from the GeoNames gazetteer and format the results as GeoJSON:

http://unlock.edina.ac.uk/ws/closestMatchSearch?name=Edinburgh&gazetteer=geonames&format=json
            

distanceBetween

search Calculates the distance in metres between two areas defined by their Unlock IDs, in this case, London (9676) and Edinburgh (9656):

http://unlock.edina.ac.uk/ws/distanceBetween?idA=9656&idB=9679
            

nameIndexSearch

search Can be used to populate an autocomplete search with possible place names, as in the example in Code Samples. Optional parameter callback can be used to return JSONP with a callback name of your choice. Note that the callback parameter only applies to JSON results:

http://unlock.edina.ac.uk/ws/nameIndexSearch?format=json&callback=listFeatures&name=edin