Geocoding Address Requests
Detailed documentation on how to perform geocoding address requests using Cercalia’s Suggest API.
Geocoding Address Requests
To obtain the exact coordinates of a specific address (including house number), you need to use the parameters returned from the selected candidate in the suggestions response and make a geocoding request with these parameters:
Request Parameters
Parameter | Description | Example |
---|---|---|
cmd | Fixed value cand | cand |
adr | Street name (including house number) | avinguda diagonal 200 |
ctn | Locality | barcelona |
pcode | Postal code | 08018 |
ctryc | Country code (ISO 3 characters) | ESP |
detcand | Fixed value 1 | 1 |
priorityfilter | Fixed value 1 | 1 |
Example Request:
https://lb.cercalia.com/services/v2/json?cmd=cand&adr=avinguda diagonal 200&ctn=barcelona&ctryc=ESP&detcand=1&priorityfilter=1&key=YOUR_API_KEY
Response
The service returns a JSON object containing the geocoded address with its exact coordinates.
Example Response:
{
"cercalia": {
"@cmd": "cand",
"@version": "1",
"candidates": {
"@num": "1",
"@pos": "0",
"@total": "1",
"@urlcandidates": "ctn=barcelona&stnum=200&adr=avinguda diagonal 200&ctryc=ESP",
"@urlcommon": "",
"candidate": [
{
"@desc": "Avinguda Diagonal, 200 (Barcelona)",
"@name": "Avinguda Diagonal, 200",
"@urlparams": "ctc=ESP0055169L&stc=ESP08019300000417669&stnum=200&pcode=08018",
"urlparams": {
"param": [
{
"@name": "ctc",
"@value": "ESP0055169L"
},
{
"@name": "stc",
"@value": "ESP08019300000417669"
},
{
"@name": "stnum",
"@value": "200"
},
{
"@name": "pcode",
"@value": "08018"
}
]
},
"ge": {
"@id": "ESP08019300000417669",
"@name": "Avinguda Diagonal",
"@prefix": "Avinguda",
"@sname": "Diagonal",
"@type": "adr",
"name": {
"value": "Avinguda Diagonal, 200"
},
"housenumber": {
"value": "200"
},
"postalcode": {
"@country_id": "ESP",
"@id": "08018"
},
"city": {
"@id": "ESP0055169L",
"value": "Barcelona"
},
"district": {
"@id": "ESP080190805",
"value": "El Parc i la Llacuna del Poblenou"
},
"municipality": {
"@id": "ESP080193",
"value": "Barcelona"
},
"subregion": {
"@id": "ESP08",
"value": "Barcelona"
},
"region": {
"@id": "ESPCAT",
"value": "Catalunya"
},
"country": {
"@id": "ESP",
"value": "España"
},
"coord": {
"@x": "2.19250015",
"@y": "41.4049393"
}
}
}
],
"urlcommon": {},
"urlcandidates": {
"param": [
{
"@name": "ctn",
"@value": "barcelona"
},
{
"@name": "stnum",
"@value": "200"
},
{
"@name": "adr",
"@value": "avinguda diagonal 200"
},
{
"@name": "ctryc",
"@value": "ESP"
}
]
}
},
"server": {
"value": "lb.dev.cercalia.com"
},
"instance": {
"value": "http://master-cercalia-lbs-both-lines"
}
}
}
Note: Replace YOUR_API_KEY with your actual API key provided by Cercalia.
For more detailed information, refer to the Cercalia Suggest API Documentation.