Geocoding (batch)

Basic principles

The query includes an address or several addresses as input, the service returns for each item, one or several possible responses (if there is any ambiguity), including the address recognised, the position, the geocoding score and the type of geocoding.

Batch geocoding example

{
        "url":"https://api.geoconcept.com/EU/GCW/geoconcept-web/api/lbs/geocode/batch/v4.json",
        "method":"POST",
        "body": {
      "addresses": [
          {
            "addressLine" : "200 Quai Charles de Gaulle",
            "city" : "Lyon",
            "region" : "",
            "countryCode" : "FR",
            "postCode" : "69006"
          },
          {
            "addressLine" : "Bruno Kreisky Platz 1",
            "city" : "Wien",
            "region" : "",
            "countryCode" : "AT",
            "postCode" : "1220"
          },
          {
            "addressLine" : "Route des Morillons 15",
            "city" : "Genève",
            "region" : "",
            "countryCode" : "CH",
            "postCode" : "1202"
          }
      ],
      "streetMinScore": 80,
      "srs": "epsg:4326",
      "maxResponses": 1,
      "improve": false,
      "excludePlaces": true
    }
}

Parameters / properties

Input

parameter description optional default

addresses array of GeocodeRequestV4

The addresses to geocode

no

improve

try to get better results on the wrong candidates. The resulting output format may be slightly different from the candidates improved.

yes

false

maxResponses

maximum number of address results in the response (max = 5)

yes

1

srs

projection (EPSG code such as epsg:4326 or wgs 84)

yes

Without projection, the result is in native projection of the geocoding index, usually wgs84.

streetMinScore

the value of this parameters varies, as for the score, between 0 and 100.
The streetMinScore has the effect of filtering possible candidates in the following way:
If the candidate score is equal to or higher than the score, the candidate is selected as it is,
If the candidate score is lower than the score and no candidate match has already been selected, the geocoding is suggested at city level
90 is the recommended value to avoid wrong positives candidates, 50 can be used in case of manual control of the candidates

yes

0

excludePlaces

Should responses show places, or only addresses?

yes

false

Addresses (GeocodeRequestV4)

parameter description optional default

id

convenience identifier for this address.
Optional : this identifier has no functional role, it might be used by the caller to identify individual input addresses to geocode and output in results

yes

comment

convenience comment for this address

yes

addressLine

address including the number, repetition index, type of street and street name.

yes *

addressLineExt

second address (with a street number and street name) to find if first is too bad

yes

city

town

yes *

district

district (part of city)

yes

postCode

post code

yes *

region

State, County, …

yes

countryCode

country on two or three letters (ISO code 3166-1) for example, "fr" or "fra"

yes

(*) At least one of the three parameters postCode, addressLine and city must be filled.

Output

parameter type min/max description

geocodedAddresses

array of GeocodedAddressV4

0/unlimited

Geocoded addresses

id

string

0/1

identifier used in input

comment

string

0/1

comment used in input

Geocoded addresses (GeocodedAddressV4)

parameter type min/max description

score

double

1/1

geocoding score from 0 to 100, with 100 for a perfect correspondance

geocodeType

int

1/1

type of geocoding:
- not geocoded = 0
- town = 1
- street = 2
- street enhanced = 3
- street number = 4

geocodeTypeQuality

string

1/1

geocode quality:
- "NOT_FOUND"
- "ADDRESS_POINT"
- "POI"
- "NAMED PLACE"
- "CITY+POSTCODE"
- "CITY"
- "DISTRICT+POSTCODE"
- "DISTRICT"
- "STREET"
- "ZONE+POSTCODE"
- "STREET NUMBER INTERPOLATION"
- "STREET NUMBER BOUND"
- "STREET NUMBER ESTIMATION"
- "STREET NUMBER NEAREST"
- "PONCTUAL POSTCODE"

x

double

1/1

X coordinates

y

double

1/1

Y coordinates

streetNumber

string

0/1

street number

streetWayType

string

0/1

type of street (avenue, street, etc)

streetWayName

string

0/1

street name

streetWay

string

0/1

full name of the street

addressLine

string

0/1

street found and, if there is one, the number

city

string

0/1

town found

region

string

0/1

State, County, … found, varies as a function of country, can also be empty

postCode

string

0/1

post code found

countryCode

string

1/1

Country on three letters (ISO code 3166-1)

places

Array of GeocodedAddressPlaceItem

0/unlimited

list of containing places. Output attribute values of the found address, according "placeTypes" (for example ["751010206","930005Y001XCHE"]). Depends on the country and the repository used.

Places (GeocodedAddressPlaceItem)

parameter type min/max description

placeType

string

0/1

list of types of attributes (for example ["IRIS","INSEE","…"]). Depends on the country and the repository used.

placeValue

string

0/1

list of attributes. Value of attributes for the address found, in relation to placeTypes . Depends on the country and the repository used.

Initial address (initialAddress)

parameter type min/max description

addressLine

string

0/1

street found and, where appropriate, the number

city

string

0/1

town found

region

string

0/1

State, County, found, varies as a function of country, and could also be empty

countryCode

string

1/1

cf. description of the input parameter

postCode

string

0/1

post code found

Possible returns

Case of an address found (status is OK) 

{
    "status": "OK",
    "results": [
        {
            "status": "OK",
            "geocodedAddresses": [
                {
                    "addressLine": "200 QUAI CHARLES DE GAULLE",
                    "district": "6E ARRONDISSEMENT",
                    "city": "LYON",
                    "countryCode": "FRA",
                    "postCode": "69006",
                    "score": 100.0,
                    "geocodeType": 4,
                    "geocodeTypeQuality": "ADDRESS_POINT",
                    "x": 4.847616,
                    "y": 45.782431,
                    "streetNumber": "200",
                    "streetWayType": "QUAI",
                    "streetWayName": "CHARLES DE GAULLE",
                    "streetWay": "QUAI CHARLES DE GAULLE",
                    "places": [
                        {
                            "placeType": "INSEE",
                            "placeValue": "69386"
                        },
                        {
                            "placeType": "IRIS",
                            "placeValue": "693860101"
                        },
                        {
                            "placeType": "LEVEL_1",
                            "placeValue": "France"
                        },
                        {
                            "placeType": "LEVEL_2",
                            "placeValue": "Auvergne-Rhône-Alpes"
                        },
                        {
                            "placeType": "LEVEL_3",
                            "placeValue": "Rhône"
                        },
                        {
                            "placeType": "LEVEL_4",
                            "placeValue": "Lyon"
                        },
                        {
                            "placeType": "LEVEL_5",
                            "placeValue": "6e Arrondissement"
                        }
                    ]
                }
            ]
        },
        {
            "status": "OK",
            "geocodedAddresses": [
                {
                    "addressLine": "BRUNO-KREISKY-PLATZ 1",
                    "district": "22. BEZIRK-DONAUSTADT",
                    "city": "WIEN",
                    "countryCode": "AUT",
                    "postCode": "1220",
                    "score": 100.0,
                    "geocodeType": 4,
                    "geocodeTypeQuality": "ADDRESS_POINT",
                    "x": 16.413865,
                    "y": 48.234572,
                    "streetNumber": "1",
                    "streetWayType": "",
                    "streetWayName": "BRUNO-KREISKY-PLATZ",
                    "streetWay": "BRUNO-KREISKY-PLATZ",
                    "places": [
                        {
                            "placeType": "INSEE",
                            "placeValue": ""
                        },
                        {
                            "placeType": "IRIS",
                            "placeValue": ""
                        },
                        {
                            "placeType": "LEVEL_1",
                            "placeValue": "Österreich"
                        },
                        {
                            "placeType": "LEVEL_2",
                            "placeValue": "Wien"
                        },
                        {
                            "placeType": "LEVEL_3",
                            "placeValue": "Wien"
                        },
                        {
                            "placeType": "LEVEL_4",
                            "placeValue": "Wien"
                        },
                        {
                            "placeType": "LEVEL_5",
                            "placeValue": "22. Bezirk-Donaustadt"
                        }
                    ]
                }
            ]
        },
        {
            "status": "OK",
            "geocodedAddresses": [
                {
                    "addressLine": "ROUTE DES MORILLONS 15",
                    "district": "",
                    "city": "GENÈVE",
                    "countryCode": "CHE",
                    "postCode": "1218",
                    "score": 99.98,
                    "geocodeType": 3,
                    "geocodeTypeQuality": "STREET NUMBER NEAREST",
                    "x": 6.13245,
                    "y": 46.231514,
                    "streetNumber": "",
                    "streetWayType": "ROUTE",
                    "streetWayName": "DES MORILLONS",
                    "streetWay": "ROUTE DES MORILLONS",
                    "places": [
                        {
                            "placeType": "INSEE",
                            "placeValue": ""
                        },
                        {
                            "placeType": "IRIS",
                            "placeValue": ""
                        },
                        {
                            "placeType": "LEVEL_1",
                            "placeValue": "Suisse"
                        },
                        {
                            "placeType": "LEVEL_2",
                            "placeValue": "Genève"
                        },
                        {
                            "placeType": "LEVEL_3",
                            "placeValue": "Genève"
                        },
                        {
                            "placeType": "LEVEL_4",
                            "placeValue": "Genève"
                        },
                        {
                            "placeType": "LEVEL_5",
                            "placeValue": ""
                        }
                    ]
                }
            ]
        }
    ]
}

Case of an address that is not found (status is OK and no geocodedAddress) 

{
  "message": null,
  "status": "OK",
  "results": [
    {
      "message": null,
      "status": "OK",
      "geocodedAddresses": [],
      "initialAddress": {
        "addressLine": "",
        "city": "#sdsdsdsds",
        "region": "",
        "countryCode": "FR",
        "postCode": ""
      }
    }
  ]
}

Case of a query with a non-existent reprojection system ⇒ error with faultstring that contains the description 

An error append : (500) Internal Server Error
ServiceException: Geocode failed
Geocode failed
Failed to process geocoding task
Unsupported coordinate system 'wgs841'

FAQ

See Geocoding Web service.

1. How to use the cURL command?

1.

How to use the cURL command?

It is necessary to use an address file, here in json format, with the following command line:

curl -X POST 'https://api.geoconcept.com/EU/GCW/geoconcept-web/api/lbs/geocode/batch/v4.json?appkey=XXXXX&apptoken=YYYYY' -H 'Content-Type: application/json' -F file=@"adresses.json"

File: adresses.json

{
   "addresses":[
      {
         "addressLine":"200 Quai Charles de Gaulle",
         "city":"Lyon",
         "region":"",
         "countryCode":"FR",
         "postCode":"69006"
      },
      {
         "addressLine":"Bruno Kreisky Platz 1",
         "city":"Wien",
         "region":"",
         "countryCode":"AT",
         "postCode":"1220"
      },
      {
         "addressLine":"Route des Morillons 15",
         "city":"Genève",
         "region":"",
         "countryCode":"CH",
         "postCode":"1202"
      }
   ],
   "streetMinScore":80,
   "srs":"epsg:4326",
   "maxResponses":2
}