Reverse search
Connection URL: https://eines.icgc.cat/geocodificador/invers (GET)
Description
The invers operation (reverse geocoding) searches for the closest addresses, place names or kilometric points to a given geographic point, specified by its latitude and longitude.
The result is obtained in GeoJSON format.
For example, to search for the address closest to the coordinates 41.385965, 2.16687, you must make the request https://eines.icgc.cat/geocodificador/invers?lat=41.385965&lon=2.16687&size=1&layers= address, which has the answer:
Building the query
The API request is built from the URL https://eines.icgc.cat/geocodificador/invers, followed by the ? sign and the sequence of parameters, separated by the sign &.
The parameters are as follows:
-
lon, lat: are mandatory and contain the coordinates of the geographical point around which the search is to be made.
Example: http://eines.icgc.cat/geocodificador/invers?lon=0.20949814&lat=41.12599206
-
boundary.circle.radius: indicates the radius of the search circle (in km).
-
layers: Filter by data type
The types of data to search can be differentiated by indicating the layers parameter, with the following values:
.address: postal addresses
. tops: all toponyms
.topo_tipus_id: toponyms of type id, where id is a string of numbers between 1 and 22, adding leading 0 if less than 10. For example: topo_tipus_01 to search for Caps de municipi. The table with the types of toponyms and their identifiers can be consulted at Toponyms table
The following values can be indicated to segregate the toponyms into two groups:
.topo1: toponyms referring to population groups (municipalities, capitals of municipalities, population entities, disseminated and neighborhoods)
.topo2: rest of toponyms.
.pk: kilometric point.
Example, to find toponyms: [http://eines.icgc.cat/geocodificador/invers?lon=0.20949814&lat=41.12599206&layers=tops](http://eines.icgc.cat/geocodificador/invers?lon=0.20949814&lat=41.12599206&layers=tops){target="_blank"}
- size: is used to define the maximum number of results
By default, up to 10 results of each of the types indicated in layers are returned. A different number can be specified with the size parameter. The maximum value is 40.
For example, to find a single place name: http://eines.icgc.cat/geocodificador/invers?lon=0.20949814&lat=41.12599206&layers=tops&size=1
- com: to filter by 'comarca'
The com parameter allows you to specify the name of the 'comarca' or its identifier.
You can consult the list of 'comarca' in Table of regions
Examples:
https://eines.icgc.cat/geocodificador/invers?lon=2.094256&lat=41.432308&layers=tops&size=10&com=barcelones ( indicating the name of the 'comarca')
https://eines.icgc.cat/geocodificador/invers?lon=2.094256&lat=41.432308&layers=tops&size=10&com=13 ( indicating 'comarca''s identifier)
- mun: to filter by municipality
The mun parameter allows you to specify the name of the municipality or its identifier.
The list of municipalities can be consulted at Table of municipalities
Examples:
[https://eines.icgc.cat/geocodificador/invers?lon=2.094256&lat=41.432308&layers=tops&size=10&mun=barcelona](https://eines.icgc.cat/geocodificador/invers?lon=2.094256&lat=41.432308&layers=tops&size=10&mun=barcelona){target="_blank"} ( indicating the name of the municipality)
[ https://eines.icgc.cat/geocodificador/invers?lon=2.094256&lat=41.432308&layers=tops&size=10&mun=080193]( https://eines.icgc.cat/geocodificador/invers?lon=2.094256&lat=41.432308&layers=tops&size=10&mun=080193){target="_blank"} ( indicating municipality's identifier)
Input parameters
Parameter | Type | Mandatory | Description | Default value | Example |
---|---|---|---|---|---|
lat | floating point number | Yes | latitude | 41.385965 | |
lon | floating point number | Yes | longitude | 2.094256 | |
boundary.circle.radius | floating point number | No | search circle radius (km) | 1 | 0.5 |
layers | text string | No | Type of elements to search: [address, tops, topo_tipus_id, topo1, topo2, pk] | topo1,topo2,address,pk | address,topo1 |
size | integer | No | Number of results. The maximum is 40 | 10 | 5 |
com | text string | No | Identifier of a 'comarca'', within which you want to restrict the search | none | 01 |
mun | text string | No | Identifier of a municipality, within which you want to restrict the search | none | 080018 |
Output parameters
Results are returned in GeoJSON format.
The features.properties element has the fields described in the following table:
Field | Description | Applicable to elements |
---|---|---|
layer | Type of element. The possible values are those indicated in the input layers parameter | All |
etiqueta | Field Aggregation. By address: portal street, municipality ('llogaret'). Note: If the 'llogaret' coincides with the municipality, it is not indicated. By place names: place name, municipality.By kilometric point: road km | All |
municipi | Municipality. In some toponyms, there is no municipality assigned and it takes the value "-" | Addresses and toponyms |
id_municipi | Municipi ID. In some toponyms, there is no municipality assigned and it takes the value "" | Addresses and toponyms |
comarca | 'comarca'. In some toponyms, there is no 'comarca' assigned and it takes the value "-" | Addresses and toponyms |
id_comarca | 'comarca' ID. In some toponyms, there is no 'comarca' assigned and it takes the value "" | Addresses and toponyms |
llogaret | 'llogaret' | Addresses |
portal | Housenumber of the address | Addresses |
nom | Name of the street, isolated building or toponym | Addresses and toponyms |
tipus_via | Street type | Addresses |
codi_postal | Postal code | Addresses |
addendum.origin | Scale origin | Place names |
addendum.zoom | Optimum zoom level | Place names |
addendum.tipus | Toponym type | Place names |
addendum.id_tipus | Toponym type identifier | Place names |
addendum.municipis_extra | Other municipalities assigned | Place names |
addendum.bbox | Geographic coordinates of the rectangle containing the street | Addresses |
addendum.bbox_utm | UTM coordinates of the rectangle containing the street | Addresses |
via | Road ID | Kilometric point |
km | KM (to 1 decimal places) | Kilometric point |
Output examples according to layer type
Postal address |
---|
https://eines.icgc.cat/geocodificador/invers?lon=2.13798&lat=41.4271&layers=address&size=1 |
Toponym |
---|
https://eines.icgc.cat/geocodificador/invers?lon=0.20949814&lat=41.12599206&layers=tops&size=1 |
Kilometric point |
---|
https://eines.icgc.cat/geocodificador/invers?lon=1.90750462&lat=41.78388114&layers=pk&size=1 |