Address selection guide

Baltic address catalogue (Estonia, Latvia and Lithuania): look up an address by ID, fetch the parent object chain and browse the address tree as cascade selections. The country is selected with c=ee|lv|lt (Estonia by default).

Live examples. Requests and responses were made against https://pump.elemroot.com/Gazetter. The service always returns JSON and every response includes the success field.
Contents

Endpoints and routing

Base: https://pump.elemroot.com/Gazetter. Each sub-service has its own path:

PathPurposeParameters
/layer/getDescription/Full address by IDid
/layer/getFillInfo/Parent object chainid
/layer/currentLayer/Address list at levell, p, g, c

All three endpoints additionally accept the country parameter c (ee / lv / lt, default ee): see the countries chapter.

The same can be called with the layer parameter:

https://pump.elemroot.com/Gazetter/?key=docs_382d376eaaa6d004b7b93b7d&layer=getdescription&id=3069760

Values: getdescription, getfillinfo, currentlayer. Without layer the service returns {"success": false}.

The two forms behave differently. The path form (/layer/currentLayer/) is case-sensitive: /layer/CURRENTLAYER/ returns 404. The parameter form (?layer=…) is case-insensitive. A trailing slash is not required in either.

Both forms also accept POST (application/x-www-form-urlencoded). NB: the key must still be in the URL, not only in the form body.

Countries: Estonia, Latvia, Lithuania (parameter c)

The gazetteer covers three countries. The country is selected with the c parameter: ee (default), lv or lt; an unknown value behaves like ee. The parameter applies to all three endpoints and IDs are country-scoped: the same id means a different object in a different country, so pass c also to getDescription / getFillInfo requests.

Request: Latvian level 1
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?key=docs_382d376eaaa6d004b7b93b7d&l=1&c=lv"
Response (shortened)
{
  "success": true,
  "addressList": [
    { "id": 1100016630, "nimi": "Aizkraukles nov." },
    { "id": 1100003028, "nimi": "Jelgava" },
    { "id": 1100003003, "nimi": "Rīga" }
  ]
}

Levels per country

The level scale l=1–6 is shared, but the content differs and the levels are not equivalent across countries. The key difference: level 1 in Latvia and Lithuania is the municipality, while in Estonia the municipality is level 2; Latvia abolished its districts in 2009 and the Lithuanian apskritis is not part of the official address, so neither country has a county level. The same applies at level 2: the Latvian pagasts and the Lithuanian seniūnija are not municipalities but territorial subdivisions of one.

lEstoniaLatviaLithuania
1CountyNovads / valstspilsētaSavivaldybė
2MunicipalityPagasts / town of a novadsSeniūnija (absent in cities)
3SettlementCiemsGyvenamoji vietovė (miestas / kaimas / miestelis / viensėdis)
4Street / small placeIelaGatvė
5HouseMāja (number or name)Namas
6FlatDzīvoklisButas

When building a form, mind the country quirks:

IDs and fields in LV/LT responses

Parameter reference

ParamMeaningAllowed values / exampleDefault
id *Object AADRESS_ID (getDescription, getFillInfo)3069760—
cCountry: an unknown value behaves like eeee, lv, ltee
callbackJSONP callbackfunction name, e.g. cb—
key *API key (403 without one)docs_…—
l *Level 1…6: at levels 5-6 p or g is required1 county … 4 street/small place, 5 building, 6 flat—
pParent AADRESS_ID (one level up)2822791—
gGrandparent AADRESS_ID: used only when p is absent2822791—

Address by AADRESS_ID (getDescription)

Returns the full address record for the given id (= AADRESS_ID). Use this when you already have an address ID: e.g. from geocoding output (AADRESS_ID / <aid>; Estonian IDs go in as they are, LV/LT IDs need the level prefix, see above).

Request
curl "https://pump.elemroot.com/Gazetter/layer/getDescription/?key=docs_382d376eaaa6d004b7b93b7d&id=3069760"
Response
{
  "object": {
    "R_ID": 3069760,
    "AADRESS_ID": 3069760,
    "KOODAADRESS": null,
    "POSTIINDEKS": "60532",
    "E": 26.74628263,
    "N": 58.39577394,
    "AADRESS_ID_YLES": 3040077,
    "A_LOOMISE_AEG": null,
    "A_MUUTMISE_AEG": null,
    "A_STAATUS_ID": 1,
    "A_KIHT_ID": null,
    "A0_NIMI": "Eesti Vabariik",
    "A1_NIMI": "Tartu maakond",
    "A1_EHAK": "0079",
    "A2_NIMI": "Tartu linn",
    "A2_EHAK": "0793",
    "A3_NIMI": "Tartu linn",
    "A3_EHAK": "8151",
    "A4_NIMI": null,
    "A5_NIMI": "Muuseumi tee",
    "A5_NIMI_INIT": "Muuseumi tee",
    "A6_NIMI": null,
    "A7_NIMI": "2",
    "A8_NIMI": null,
    "A3_POP": null,
    "POP": 99900
  },
  "success": true
}

Important fields:

FieldMeaning
AADRESS_IDAddress object ID
AADRESS_ID_YLESParent object ID (one level up)
E / NCoordinates (longitude / latitude, EPSG:4326)
POSTIINDEKSPostal code
A1_NIMI … A8_NIMIAddress components: A1 county, A2 municipality, A3 settlement, A4 small place, A5 street, A6 name (e.g. farm), A7 house number, A8 flat. Missing components are null (like A4_NIMI/A6_NIMI/A8_NIMI in the example). Values are always strings, even when they look numeric ("A7_NIMI": "2")
A1_EHAK … A3_EHAKEHAK codes
A5_NIMI_INITStreet name short form (e.g. "Anne tn"; same as full name for "Muuseumi tee")
POP / A3_POPPopulation
A_STAATUS_ID / A_KIHT_IDAddress status / layer

For an unknown ID the service returns {"success": false}.

AADRESS_ID → full address (with geocoding)

Geocoding does not support lookup by AADRESS_ID: this ID appears only in the output. To get a full address by ID use gazetteer getDescription, which returns the full record (components + coordinates). Typical workflow:

  1. You have AADRESS_ID (e.g. from a previous geocoding response: field AADRESS_ID / <aid>, or from a database).
  2. Fetch full address by ID:
    curl "https://pump.elemroot.com/Gazetter/layer/getDescription/?key=docs_382d376eaaa6d004b7b93b7d&id=3069760"
    Response includes components A1_NIMI…A7_NIMI, POSTIINDEKS and coordinates E/N; the address is already complete (no geocoding needed for coordinates).
  3. If you still want to run it through geocoding (e.g. in another coordinate system, or to get json2/kml output), build address text from getDescription fields and send to the geocoder. Postal code (POSTIINDEKS) ensures the correct location:
    curl "https://pump.elemroot.com/jgc_rest/geocode?q=Muuseumi+tee+2,+60532&gl=ee_aid&output=json2&srs=EPSG:3301&key=docs_382d376eaaa6d004b7b93b7d"
In short. getDescription(id) bridges ID and full address. Address text from there works directly as geocoding q (see refining with postal code).

Parent object chain (getFillInfo)

Returns the parent chain from leaf to root. Suitable for pre-filling cascade selections when the final AADRESS_ID is known.

Request
curl "https://pump.elemroot.com/Gazetter/layer/getFillInfo/?key=docs_382d376eaaa6d004b7b93b7d&id=3069760"
Response
{
  "addressObjects": [
    { "AADRESS_ID_YLES": 3040077, "TASE": 5, "AADRESS_ID": 3069760 },
    { "AADRESS_ID_YLES": 3020414, "TASE": 4, "AADRESS_ID": 3040077 },
    { "AADRESS_ID_YLES": 3020404, "TASE": 3, "AADRESS_ID": 3020414 },
    { "AADRESS_ID_YLES": 2822791, "TASE": 2, "AADRESS_ID": 3020404 },
    { "AADRESS_ID_YLES": 1001,    "TASE": 1, "AADRESS_ID": 2822791 }
  ],
  "success": true
}

Each element: object AADRESS_ID, its parent AADRESS_ID_YLES and TASE.

TASE uses its own 1–6 scale (the same values as the currentLayer parameter l; see the level table), not the A1…A8 component column number: 1 = county, 2 = municipality, 3 = settlement, 4 = small place/street, 5 = building, 6 = flat. For a flat the chain is TASE 6 → 5 → 4 → 3 → 2 → 1; a building without flats ends at level 5. The chain pre-fills cascade menus: each element's AADRESS_ID_YLES is the selected value of the next (higher) level.

Cascade list (currentLayer)

Lists address objects at one level (id + nimi). Use for building dropdowns: pick a county, then list municipalities, etc.

ParamMeaningAllowed values / example
lLevel (see table below)1–6
pParent AADRESS_ID (one level up)e.g. 2822791 (Tartu county)
gGrandparent AADRESS_ID (two levels up)integer (AADRESS_ID)

Levels (l)

Usable values are 1–6:

At levels 5 and 6, p (or g) is required. Without a parent the query would scan the whole dataset, so the service answers 200 with the body {"success": false, "addressList": []}.
lLevelExample response value
1County"Tartu maakond"
2Municipality (rural or urban)"Kambja vald"
3Settlement (city / town / village)"Ilmatsalu alevik"
4Street or small place"Anne tänav", "Võsula väikekoht"
5Building (house number or name)"2", "2/1", farm name
6Flat"1", "10"

Note: the level number is NOT the same as the getDescription component column A1…A8; level 4 covers both A4 (small place) and A5 (street), level 5 both A6 (name) and A7 (house number), level 6 is A8 (flat). The response nimi is whichever of the pair is present.

When p, when g?

p is the normal cascade step: list level l objects whose direct parent is p. g lets you skip one level: list objects by grandparent. Practical uses:

Request: counties (level 1)
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?key=docs_382d376eaaa6d004b7b93b7d&l=1"
Response (truncated)
{
  "success": true,
  "addressList": [
    { "id": 100002,  "nimi": "Harju maakond" },
    { "id": 100003,  "nimi": "Hiiu maakond" },
    { "id": 2822791, "nimi": "Tartu maakond" },
    { "id": 100009,  "nimi": "Saare maakond" }
  ]
}
Request: municipalities in Tartu county (level 2, parent = 2822791)
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?key=docs_382d376eaaa6d004b7b93b7d&l=2&p=2822791"
Response (truncated)
{
  "success": true,
  "addressList": [
    { "id": 2974743, "nimi": "Elva vald" },
    { "id": 2822792, "nimi": "Kambja vald" },
    { "id": 3158291, "nimi": "Kastre vald" },
    { "id": 3302125, "nimi": "Luunja vald" }
  ]
}
Request: streets and small places in a settlement (level 4, parent = 3020414 "Tartu linn")
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?key=docs_382d376eaaa6d004b7b93b7d&l=4&p=3020414"
Response (truncated)
{
  "success": true,
  "addressList": [
    { "id": 3039375, "nimi": "A. H. Tammsaare tänav" },
    { "id": 3039126, "nimi": "Anne tänav" }
  ]
}
Request: buildings on a street (level 5, parent = 3039126 "Anne tänav")
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?key=docs_382d376eaaa6d004b7b93b7d&l=5&p=3039126"
Response (truncated)
{
  "success": true,
  "addressList": [
    { "id": 3047936, "nimi": "1" },
    { "id": 3083839, "nimi": "11" },
    { "id": 3066145, "nimi": "14a" }
  ]
}
Request: flats in a building (level 6, parent = 3047936 "Anne tänav 1")
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?key=docs_382d376eaaa6d004b7b93b7d&l=6&p=3047936"
Response (truncated)
{
  "success": true,
  "addressList": [
    { "id": 3124193, "nimi": "1" },
    { "id": 3124202, "nimi": "10" }
  ]
}

If there are no objects at the level (e.g. a building without flats), the response is {"success": false, "addressList": []}; in a cascade this means the selection is complete.

Each id is an address object's AADRESS_ID, usable for the next level as parent (p) or as getDescription input.

Which combination to use

TaskCombinationWhy
Dropdown cascadel=1 → l=2&p=… → l=3&p=…each step returns the next level's children
All streets in one municipalityl=4&g=<municipality>g skips two levels at once
Pre-fill address fields from an idgetFillInfo?id=…returns the whole parent chain up to the root
Full address record by idgetDescription?id=…all components, coordinates, postal code
Latvia or Lithuaniac=lv / c=ltids are country-internal: pass c in every request
Eight cities where level 3 is empty. Narva, Maardu, Rakvere, Viljandi, Võru, Keila, Sillamäe and Loksa have no settlement level; their streets sit one level deeper. A cascade should query l=3&p=<municipality> and l=4&g=<municipality> in parallel and use whichever returns rows. An empty level is not an error, it is the administrative structure.
Example: streets of Narva (level 3 empty, level 4 via g)
curl "https://pump.elemroot.com/Gazetter/layer/currentLayer/?l=4&g=2591894&key=docs_382d376eaaa6d004b7b93b7d"

JSONP

The service returns Access-Control-Allow-Origin: *; in a modern browser plain fetch() is enough. JSONP remains for older clients.

For JSONP add callback: the response is wrapped in a function call:

curl "https://pump.elemroot.com/Gazetter/layer/getDescription/?key=docs_382d376eaaa6d004b7b93b7d&id=3069760&callback=cb"
cb({"object":{ ... },"success":true})

Content-Type stays application/json also for JSONP, and callback does not affect the server cache (the unwrapped response is cached).

Cache

Responses are cached on the server for 24 hours; the cache key is the parameter set (layer, id, l, p, g, c). After a data update a stale response may therefore persist for up to a day; keep this in mind when comparing a gazetteer response with a same-moment geocoding response.

Error handling

The gazetteer answers most content errors with 200 and {"success": false}; an empty result and invalid input look the same, so check your input. HTTP error codes only come for the key, the rate limit and an overly wide query.

SituationCodeResponse
layer missing or unknown200{"success": false}
Unknown or non-numeric id / p200{"success": false}
Unknown c (country)200behaves like c=ee
currentLayer at level l≥5 without p/g200{"success": false, "addressList": []}; the query would scan the whole dataset (see the warning above)
Key missing or invalid403JSON {"error":"invalid_api_key"}
Too many requests (demo key)429Too Many Requests

API reference (Swagger UI) → Interactive try-it-out. OpenAPI spec (YAML file) → Machine-readable API description for tooling. Note: opens as a raw YAML file.