ICGC Geocoder
Geocoding is the process of turning addresses and place names into geographic coordinates
The ICGC Geocoder allows you to obtain the coordinates of a place located in Catalonia from its postal address,its name (toponym) or the kilometric point. It also allows the opposite operation, reverse geocoding, which consists of obtaining the postal address, the name of the place name or the nearest kilometer point to a position expressed in coordinates.
Connection URL
https://eines.icgc.cat/geocodificador
Viewer (search, autocomplete and reverse)
The ICGC Geocoder is a Web Application Programming Interface API REST, embeddable into other applications, making it simple to add an address finder to a map viewer.
It offers the following functionalities:
- Search for postal addresses of the following types:
- House number (street name + house number + municipality or llogaret).
- Isolated building (name of the isolated building + municipality or llogaret).
- Search for streets (street name + municipality or llogaret.
- Get the bounding box of a street.
- Search for toponyms (name + municipality).
- Search for kilometric points (road number + km).
- Reverse geocoding: to get the list of places near a given latitude/longitude point.
- Search within a circular or rectangular geographic area.
- Search within a 'comarca' or a municipality.
- Narrow the search to certain types of toponyms.
- Prioritize results by proximity.
- Availability of two direct geocoding endpoints, which are advisable to combine:
- autocomplete: to give real-time result suggestions without having to type the whole location.
- search (whole search): Once the text has been completed, if the answers provided by autocomplete are not sufficient, a request can be made to the search operation.
It is recommended to use client libraries that incorporate these usage guidelines, such as Leaflet and the Nextzen (formerly Mapzen) plugin, as done in the example Viewer, implemented with Leaflet and explained in the Map Viewer with queries to the ICGC Geocoding service.
Operations
It has the following operations:
search: returns the data and location of an address or toponym (Forward geocoding).
URL: https://eines.icgc.cat/geocodificador/cerca?, mètode: GET.
Search example: https://eines.icgc.cat/geocodificador/cerca?text=cambrils&layers=topo1,topo2&size=2.
Information on the input and output parameters: Parameters of the search operation indicating the full address.
autocomplete: returns the data and location of an address or place name without the need to complete all identification data, that is, as text is entered in the search box, requests are sent to the autocomplete method, with the purpose of finding answers quickly.
URL: https://eines.icgc.cat/geocodificador/autocompletar?, method: GET.
Search example: https://eines.icgc.cat/geocodificador/autocompletar?text=cam&layers=topo1,topo2&size=2.
Information on the input and output parameters: Search operation parameters with autocomplete.
reverse search: returns the addresses and toponyms closest to a given geographic point (reverse geocoding).
URL: https://eines.icgc.cat/geocodificador/invers?, method: GET.
Search example: https://eines.icgc.cat/geocodificador/invers?lat=41.39836479&lon=1.8566894531250002&layers=address,topo1,topo2&size=5.
Information on the input and output parameters: Parameters of the reverse search operation.
The input and output parameters can also be consulted in the documentation https://eines.icgc.cat/geocodificador/api-docs/.
Examples
Below are some examples of using the ICGC geocoding service:
Search for an address:
For example, by typing "nou 3, Girona" we get the geographical coordinates of the address "Carrer Nou 3, Girona": 2.82253786,41.98266812:
Input |
https://eines.icgc.cat/geocodificador/autocompletar?text=nou%203,girona&size=1&layers=address |
Output |
Imatge
|
Reverse geocoding:
For example, by specifying the coordinate 2.82253786,41.98266812, we get the postal address "Carrer Nou 3, Girona":
Input |
https://eines.icgc.cat/geocodificador/invers?lon=2.82253786,&lat=41.98266812&size=1&layers=address |
Output |
Imatge
|
- Get the 'llogaret' an address belongs to
By searching for a postal address, we can obtain the llogaret (village or population center) to which it belongs. This information appears in the llogaret field and at the end of the label field, between parentheses.
For example, when searching for the address carrer de l'esglesia 1, la vall de boi, we get the 3 portals that are in the towns of Durro, Barruera and Taüll, belonging to the municipality la Vall de Boí.:
It is also possible to indicate the name of the driver in the request.
For example, indicate carrer de l'esglesia 1,durro:
Integration in a Leaflet viewer:
The following image shows the viewer mplemented with Leaflet, which contains a search engine for addresses and toponyms, where as the user types the text to be searched, requests are sent to the geocoding service, until the desired item and its location on the map are found.
Submitted requests use the autocompletar operation with the text parameter containing the text entered by the user.
An example of these requests is: https://eines.icgc.cat/geocodificador/autocompletar?text=nou%203&layers=topo1%2Ctopo2%2Caddress&size=5.
A Viewer with queries to the ICGC Geocoding service explains in detail how to access the viewer and how it has been implemented.
Prioritize results by proximity.
In the previous viewer you can activate the box to prioritize the results closest to the center of the map, so that, if the map is centered on the municipality of Girona, when typing "Biblioteca" we get "Girona libraries".
One of the requests is: https://eines.icgc.cat/geocodificador/autocompletar?text=bibli&focus.point.lat=41.430371882652814&focus.point.lon=1.8539428710937502&layers=topo1%2Ctopo2%2Caddress&size=5, where the text to be searched for and the point for which the answers are to be prioritized are indicated.
Narrow the search within a circular or rectangular geographic area.
The image shows Vissir application, where a query has been made to the geocoder to get the toponyms that contain the text library with coordinates within the indicated rectangle.
Example query: text parameter is set to the item you want to find and the coordinates of the rectangle are indicated in the boundary.rect parameters: https://eines.icgc.cat/geocodificador/autocompletar?text=biblioteca&layers=topo1,topo2&size=300&boundary.rect.min_lon=2.790885602127&boundary.rect.min_lat=41.951744582496&boundary.rect.max_lon=2.847448636407&boundary.rect.max_lat=42.012358869945.
Filter by toponym type.
It is possible to indicate the type of toponym to search for.
For example, the following request searches for place names with the text "Cim" amb 'aliga' type: https://eines.icgc.cat/geocodificador/autocompletar?text=aliga&layers=topo_tipus_08&size=3.
As seen in the example, the toponym type 'Cim' has the identifier topo_tipus_08.
The table with the types of toponyms and their identifiers can be consulted at Toponyms table.
Filter by 'comarca' or municipality.
It is possible to restrict the search to a 'comarca' or a municipality, indicating the parameters com or mun.
For example, the request https://eines.icgc.cat/geocodificador/autocompletar?text=biblioteca&mun=girona searches for libraries in the municipality of Girona and the request https://eines.icgc.cat/geocodificador/autocompletar?text=biblioteca&com=girones searches for libraries in the 'comarca' of Gironès.
Search for a kilometric point.
By indicating C-25 143.0 in the text parameter, we get the geographical coordinates of the kilometric point.
If the layers parameter is specified, it must contain the value pk.
Input |
https://eines.icgc.cat/geocodificador/autocompletar?text=c-25 143&size=1&layers=pk |
Output |
Imatge
|
.