This automatic completion service, or autocomplete, saves internauts time when entering place names or addresses. The function suggests likely locations as the letters of an address are typed in, or even as they are deleted, in the localisation input field.
Unlike autocompletion service, it can return places (points of interest, restaurants, monuments, etc.) in addition to addresses.
example: the internaut enters "louvre", and the service returns either:
- Louvre museum "Musée du Louvre (Pyramide du Louvre)",
- Underground stations "Palais Royal Musée du Louvre" and "Louvre Rivoli",
- Town "Louvres, Île-de-France, France",
- Car park "Le Louvre".
{ "url":"https://api.geoconcept.com/EU/GCW/geoconcept-web/api/lbs/autosuggest.json", "type":"GET", "params": { "query": { "sample":"Louvre" }, "maxItems": { "sample":"5" }, "location": { "sample":"2.30432,48.79859" }, "language": { "sample":"fr" } } }
Input
parameter | description | optional | default |
---|---|---|---|
query |
A free-text query |
no |
|
location |
The center of the search area. |
yes * |
|
bounds |
Search within a geographic area provided as a rectangle. |
yes * |
|
circle |
Search within a geographic circular area, provided as center and radius. |
yes * |
|
countryCode |
A country (or multiple countries provided as comma-separated) alpha2 or alpha-3 country codes. |
yes |
|
srs |
Coordinate system used for all coordinates (given in location parameter as input, or in AutosuggestResults’s item location
as output). |
yes |
|
language |
The language to be used for result rendering as a BCP 47 compliant language code. |
yes |
|
maxItems |
Maximum number of items to be retrieved. |
no |
5 |
extended |
When set to true, may return resultType items that are not strictly considered as an address (such as administrativeArea, or other). |
no |
false |
(*) At least one of the three parameters location, bounds or circle must be assigned a value.
Output
property | type | min/max | description |
---|---|---|---|
items |
array of AutosuggestItem |
0/unlimited |
List of proposed items resulting of the search. |
Items (AutosuggestItem)
property | type | min/max | description |
---|---|---|---|
name |
string |
0/1 |
Name of the item. Depending on the item’s resultType, it contains : |
resultType |
string |
0/1 |
Item’s result type. Possible values : |
localityType |
string |
0/1 |
When resultType is locality, contains the locality type. Possible values : |
categories |
array of string |
0/unlimited |
When resultType is place, contains a the types of the place. |
addressLabel |
string |
0/1 |
Contains an address label, that is a single string representing the item’s address. |
location |
string |
0/1 |
Item coordinates. A coordinates couple as always easting,northing (X,Y or longitude,latitude depending on the coordinate system given in the srs request parameter). Example : -2.33844,47.26113 |
distance |
number |
0/1 |
required The distance of the item from the geographical search area given in the request. Always in meters. |
The case of addresses that are found (status is OK)
{ "status": "OK", "items": [ { "name": "Musée du Louvre (Pyramide du Louvre)", "resultType": "place", "addressLabel": "Musée du Louvre, 99 Musée du Louvre, 75001 Paris, France", "location": "2.33754,48.86053", "distance": 7304.0, "categories": [ "Musée d'histoire", "Lieu d'intérêt/Attraction", "Attraction touristique", "Musée", "Musée d'art" ] }, { "name": "Métro-Palais Royal Musée du Louvre", "resultType": "place", "addressLabel": "Place du Palais-Royal, 75001 Paris, France", "location": "2.33652,48.86285", "distance": 7524.0, "categories": [ "Métro" ] }, { "name": "Louvres, Île-de-France, France", "resultType": "locality", "localityType": "city", "addressLabel": "Louvres, Île-de-France, France", "location": "2.50607,49.04632", "distance": 31242.0 }, { "name": "Métro-Louvre Rivoli", "resultType": "place", "addressLabel": "Rue de l'Amiral de Coligny, 75001 Paris, France", "location": "2.34094,48.86067", "distance": 7405.0, "categories": [ "Métro" ] }, { "name": "Le Louvre", "resultType": "place", "addressLabel": "1 Rue de Marengo, 75001 Paris, France", "location": "2.33913,48.86185", "distance": 7481.0, "categories": [ "Parking à étage", "Parking" ] } ] }
The case of parameter query is empty (status is ERROR)
{ "message": "ServiceException: Autosuggest failed|Mandatory parameter 'query' must be defined and non-empty", "status": "ERROR" }
The case of missing one of the parameters location, bounds or circle (status is ERROR)
{ "message": "ServiceException: Autosuggest failed|Required parameter missing. One of mutually exclusive parameters 'location', 'bounds' or 'circle' must be present", "status": "ERROR" }