User Tools

Site Tools


core:geocodingservice

Geocoding Service

The service permits to convert an address in its coordinates, and viceversa converts coordinates in a readable address. The service uses Open Street Map datasource to resolve addresses.

At the moment service is accessible to anonymous users.

Data types

Result data type

{
  "responseHeader": {
    "status": 0,
    "QTime": 23,
    "params": {
      "indent": "true",
      "q": "+city:trento +street:einaudi +osm_key:highway +osm_value:bus_stop",
      "_": "1385137263472",
      "wt": "json"
    }
  },
  "response": {
    "numFound": 2,
    "start": 0,
    "docs": [
      {
        "id": 276034,
        "coordinate": "46.052705,11.128174",
        "osm_id": 1125127505,
        "name": "Gramsci / Einaudi",
        "osm_key": "highway",
        "osm_value": "bus_stop",
        "street": "Gramsci / Einaudi",
        "postcode": "38100",
        "country": "Italia",
        "country_de": "Italien",
        "country_en": "Italy",
        "country_fr": "Italie",
        "country_it": "Italia",
        "city": "Trento",
        "city_it": "Trento",
        "places": "Man Malpensada, Clarina, Trento, Trento, Trentino-Alto Adige/Südtirol",
        "ranking": 0
      },
      {
        "id": 180800,
        "coordinate": "46.052891,11.129685",
        "osm_id": 546145689,
        "name": "Verona / Einaudi",
        "osm_key": "highway",
        "osm_value": "bus_stop",
        "street": "Verona / Einaudi",
        "postcode": "38100",
        "country": "Italia",
        "country_de": "Italien",
        "country_en": "Italy",
        "country_fr": "Italie",
        "country_it": "Italia",
        "city": "Trento",
        "city_it": "Trento",
        "places": "Cernidor, Clarina, Trento, Trento, Trentino-Alto Adige/Südtirol",
        "ranking": 0
      }
    ]
  }
}

The result fields aren't mandatory, so empty values are omitted from the result.

Field meaning:

  • id: id of result
  • coordinate: geographical coordinates of the address
  • osm_id: id of element in Open Street Map
  • name: name of the element
  • osm_key: open street map category (highway,amenity,tourism,historical)
  • osm_value: specified value of category open street map (example: bus_stop,unclassified,secondary,service for highway osm_key)
  • street: address of the element
  • postcode: postcode
  • country_*: country in different supported languages
  • city_*: city in different supported languages
  • places: geographical parental chain of the element
  • ranking: SOLR ranking for the element

Resources to have more details about osm_key and osm_value:

Address REST API

Returns all element matching address in input

Permission

territoryservice.data.read

Parameters

  • address: mandatory, address to search (Italy). Recommended format is <street> [, <street number>], <city>. Limited Support for search by place name.
  • latlng: optional, point from which start the research (example 46.07162359016784,11.120464357147611)
  • distance: optional, distance in km from the point within searching results [default 0.5km]
  • prettyOutput: optional, true to format the result [default false]
  • rows: optional, number of results to return [default 10]
  • start: optional, index of first element [default 0]

Request

GET /core.geocoder/spring/address?address=
Host: dev.smartcommunitylab.it
Accept: application/json

Response

Response is ordered: first elements of type street, bus stop and then other element types.

In Data types paragraph an example of response.

Location REST API

Returns all element within given distance from a input point

Permission

territoryservice.data.read

Parameters

  • latlng: mandatory, point from which start the research (example 46.07162359016784,11.120464357147611)
  • distance: optional, distance in km from the point within searching results [default 0.5km]
  • prettyOutput: optional, true to format the result [default false]
  • rows: optional, number of results to return [default 10]
  • start: optional, index of first element [default 0]

Request

GET /core.geocoder/spring/location?latlng=
Host: dev.smartcommunitylab.it
Accept: application/json

Response

See Data types paragraph for a result example

SOLR REST API

Below some example of SOLR REST API invocation. The parameters are inherited by Apache Solr search platform.

  • Resources around 100 mt from given coordinates ordered by incremental distance from the point
https://geo.smartcommunitylab.it/core.geocoder/collection1/select?q=*%3A*&fq=%7B!geofilt%7D&sort=geodist()+asc&wt=json&indent=true&spatial=true&pt=46.05125%2C11.12361&sfield=coordinate&d=0.1&omitHeader=true
  • Resources containing 'einaudi' in Trento around 1km from given coordinates ordered by incremental distance
https://geo.smartcommunitylab.it/core.geocoder/collection1/select?q=street%3Aeinaudi&fq=%7B!geofilt%7D&sort=geodist()+asc&wt=json&indent=true&spatial=true&pt=46.05125%2C11.12361&sfield=coordinate&d=1&omitHeader=true
  • Streets in Trento containing 'einaudi'
https://geo.smartcommunitylab.it/core.geocoder/collection1/select?q=%2Bcity%3Atrento+%2Bstreet%3Aeinaudi+%2Bosm_key%3Ahighway&wt=json&indent=true
  • Bus stops in Trento containing 'einaudi'
 https://geo.smartcommunitylab.it/core.geocoder/collection1/select?q=%2Bcity%3Atrento+%2Bstreet%3Aeinaudi+%2Bosm_key%3Ahighway+%2Bosm_value%3Abus_stop&wt=json&indent=true

For more details about query syntax visit these resources:

Response

Response example is described in Data types paragraph

Credits & Licenses

The geocoding engine consists of an opportunely wrapped instance of Photon.

The geocoder software is released under Apache License 2.0.

The geocoder data are derived from the Photon DB. Their usage respects the terms of the original ODbL license.

core/geocodingservice.txt · Last modified: 03/12/2015 17:26 by Raman