Search API

The Search API with autocomplete. It can be also used as a less strict geocoder.

API URL

The request URL should match the following pattern:

https://api.kartes.lv/v3//search?

By default, the response is given in JSON (JSONP and XML are also available).

The HTTP GET request method is used.

  • client_key: Your authorisation key.

Query parameters

The request consists of the following GET parameters:

Parameter Description Possible values
q String query.
limit Maximum number of returned objects. Up to 50 objects can be returned from each category.
mode
  • compact
  • full
layers Object categories (comma separated)
iso_code Country (LVA for Latvia, EST for Estonia, LTU for Lithuania) LVA, EST, LTU
format Response format.
  • standart
  • geojson
fields Fields that might be in the response (comma separated).
  • name - name of the object (in case of an adress, full address)
  • maja - house number or name
  • iela - street name
  • pop_place - populated place (city, town, village)
  • iso_code - country code.
  • Bounding box coordinates:
    • x_min - the minimum x-coordinate
    • y_min - the minimum y-coordinate
    • x_max - the maximum x-coordinate
    • y_max - the maximum y-coordinate
  • x_first - the first x-coordinate
  • y_first - the first y-coordinate
  • the_geom - object geometry (WKT)
  • hash - hash code (for use in other API)
cs Coordinate system (optional parameter). By default, the WGS-84 (EPSG:4326) coordinates are used. The parameter allows to set other CRS.
  • wgs84 - WGS-84 (EPSG:4326)
  • lks - TM Baltic93 (EPSG:25884)
magicKey The hash code (only for addresses).
region The administrative or territorial unit (parish, municipality, district) where. It's possible to define the region also from a WKT polygon.
post Searches only into areas with specified postal codes (only for addresses). Example: LV-1021,LV-1050
postGroups Searches only into areas with specified postal code groups (only for addresses). Example: LV-10,LV-54

Object categories (layers)

  • adrese - addresses,
  • apdz_vieta - populated places (cities, towns, villages),
  • admin_vien - administrative units,
  • terit_vien - territorial units,
  • historical_address - historical addresses,
  • iela - streets (names) and roads (national route numbers, names),
  • river - rivers, canals,
  • lake - lakes, other water bodies,
  • public-transport - public transport stops,
  • hotels - hotels and other accommodation establishments,
  • fuel - fuel, LNG and charging stations,
  • education - education institutions,
  • airports - airports,
  • religion - churches and other religious sites,
  • museum - museums,
  • culture - cultural institutions,
  • shopping - shopping malls and other stores,
  • skiing - skiing tracks and slopes,
  • nature - nature sightseeing objects.

Response parameters

The response consists of all queried data categories having an array of objects with parameters defined by the fields parameter.

Examples

Address search

Input:

https://api.kartes.lv/v3//search?q=krasta%20105%20riga&layers=adrese&cs=wgs84&fields=name,maja,iela,pop_place,terit_vien,admin_vien,iso_code,index,x,y

Response:

{
  "adrese": [
    {
      "name": "Krasta iela 105, Rīga, Latgales pr-pilsēta, Latvija",
      "maja": "105",
      "iela": "Krasta iela",
      "pop_place": "Rīga",
      "terit_vien": "Latgales priekšpilsēta",
      "admin_vien": "Rīga",
      "iso_code": "LVA",
      "index": "LV-1019",
      "x": 24.16781,
      "y": 56.921167
    },
    {
      "name": "Krasta iela 105A, Rīga, Latgales pr-pilsēta, Latvija",
      "maja": "105A",
      "iela": "Krasta iela",
      "pop_place": "Rīga",
      "terit_vien": "Latgales priekšpilsēta",
      "admin_vien": "Rīga",
      "iso_code": "LVA",
      "index": "LV-1019",
      "x": 24.168581,
      "y": 56.921337
    }
  ]
}

Other

Input:

https://api.kartes.lv/v3//search?q=rododendru%20iela%20rīga&layers=iela&cs=wgs84&fields=name,pop_place,iso_code,x_min,y_min,x_max,y_max,x_first,y_first,the_geom

Response:

{
    "iela":[
        {
            "name":"Rododendru iela",
            "pop_place":"Rīga",
            "iso_code":"LVA",
            "x_min":"24.047660",
            "y_min":"56.947559",
            "x_max":"24.054698",
            "y_max":"56.949043",
            "x_first":"24.054698",
            "y_first":"56.949043",
            "the_geom":"LINESTRING(24.054698 56.949043,24.054371 56.948994,24.054241 56.948963,24.054074 56.948904,24.053951 56.94885, ...)"
        }
    ]
}

Input:

https://api.kartes.lv/v3//search?q=berlīne&cs=wgs84&format=geojson&fields=name,pop_place,iso_code,x_min,y_min,x_max,y_max,x_first,y_first,the_geom

Response:

{
  "apdz_vieta": {
    "type": "FeatureCollection",
    "name": "apdz_vieta",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": []
  },
  "adrese": {
    "type": "FeatureCollection",
    "name": "adrese",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [
            26.328814481721,
            56.97748106838
          ]
        },
        "properties": {
          "name": "Berlīne, Cesvaines pag., Cesvaines nov., Latvija",
          "iso_code": "LVA"
        }
      },
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [
            25.6685722292,
            57.192809547425
          ]
        },
        "properties": {
          "name": "Berlīne, Dzērbene, Dzērbenes pag., Vecpiebalgas nov., Latvija",
          "pop_place": "Dzērbene",
          "iso_code": "LVA"
        }
      },
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [
            26.606173067191,
            56.826337109232
          ]
        },
        "properties": {
          "name": "Berlīne, Meirāni, Indrānu pag., Lubānas nov., Latvija",
          "pop_place": "Meirāni",
          "iso_code": "LVA"
        }
      },
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [
            24.946031608715,
            57.347813667374
          ]
        },
        "properties": {
          "name": "Berlīne, Straupe, Straupes pag., Pārgaujas nov., Latvija",
          "pop_place": "Straupe",
          "iso_code": "LVA"
        }
      }
    ]
  },
  "admin_vien": {
    "type": "FeatureCollection",
    "name": "admin_vien",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": []
  },
  "terit_vien": {
    "type": "FeatureCollection",
    "name": "terit_vien",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": []
  },
  "iela": {
    "type": "FeatureCollection",
    "name": "iela",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "type": "MultiLineString",
          "coordinates": [
            [
              [
                24.820069,
                56.534862
              ],
              ...
            ],
            ...
          ]
        },
        "properties": {
          "name": "Berlīnes ceļš",
          "iso_code": "LVA",
          "x_min": "24.820069",
          "y_min": "56.523434",
          "x_max": "24.826498",
          "y_max": "56.534862",
          "x_first": "24.820069",
          "y_first": "56.534862"
        }
      },
      {
        "type": "Feature",
        "geometry": {
          "type": "MultiLineString",
          "coordinates": [
            [
              [
                24.616222,
                56.894474
              ],
              [
                24.617474,
                56.893912
              ],
              ...
            ],
            ...
          ]
        },
        "properties": {
          "name": "Berlīnes līnija",
          "iso_code": "LVA",
          "x_min": "24.616222",
          "y_min": "56.893680",
          "x_max": "24.687871",
          "y_max": "56.908783",
          "x_first": "24.616222",
          "y_first": "56.894474"
        }
      }
    ]
  },
  "river": {
    "type": "FeatureCollection",
    "name": "river",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": []
  },
  "lake": {
    "type": "FeatureCollection",
    "name": "lake",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": []
  },
  "mountain": {
    "type": "FeatureCollection",
    "name": "mountain",
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:EPSG::4326"
      }
    },
    "features": []
  }
}