Data API

Places

Places

Several queries find places and features. geocode turns free text into named places, reverseGeocode turns a coordinate into the nearest places, pois lists points of interest in an area, and search runs one full-text query across places, POIs, ways, and your own itineraries, collections, and zones.

All coordinates are [longitude, latitude] in WGS 84.

geocode

Forward-geocode a free-text query into a ranked list of named places such as cities, regions, natural features, and addresses.

Input

geocode(input: GeocodeInput!)

query

String!

required

Search text, 1 to 200 characters after trimming. For example Chamonix or Mont Blanc.

language

Language

Biases result names. Defaults to English.

limit

Int

default: 10

Maximum number of places to return (1 to 50).

focus

[Float!]

[longitude, latitude] center that biases ranking toward nearby results.

bbox

[Float!]

[minLon, minLat, maxLon, maxLat] bounding box that restricts the search area.

layers

[GeocodeLayer!]

Restrict results to specific layers. Every layer is eligible when omitted.

categories

PlaceCategoriesInput

Boolean-per-category filter on the output (populatedPlace, naturalFeature, amenity, and so on). Every category is allowed when omitted.

The layers filter accepts these values:

LayerScope
COUNTRYCountry-level administrative boundary.
REGIONRegion or state within a country.
COUNTYCounty or department within a region.
CITYCity, town, or village.
DISTRICTDistrict or neighborhood within a city.
POSTCODEPostal code area.
STREETStreet or road.
HOUSEHouse or building address.
POIPoint of interest.
NATURALNatural feature such as a mountain, lake, or forest.

Layers are ordered from the coarsest scope (COUNTRY) to the finest (HOUSE, NATURAL). Pass a subset to a geocode query to restrict the result granularity.

Example

query Geocode($input: GeocodeInput!) {
  geocode(input: $input) {
    count
    places {
      name
      label
      layer
      category
      point
      country
      region
      city
      score
    }
  }
}

Response

GeocodeResult carries count and a places list ordered by relevance. Each Place includes:

name

String!

Localized display name.

label

String!

Single-line label derived from city, region, and country.

layer

GeocodeLayer!

Canonical layer for the place.

category

PlaceCategory!

Canonical category, the dimension categories filters on.

point

[Float!]!

Centroid as [longitude, latitude].

bounds

[Float!]

Extent as [minLon, minLat, maxLon, maxLat], when known.

score

Float!

Relevance score. Higher is more relevant.

Place also exposes country, countryName, region, county, city, postcode, street, housenumber, and an osm reference to the source feature.

Run this query live: open it in the playground and try it against the schema.

reverseGeocode

Reverse-geocode a [longitude, latitude] point into the named places closest to it.

Input

reverseGeocode(input: ReverseGeocodeInput!)

point

[Float!]!

required

Anchor point as [longitude, latitude].

language

Language

Biases result names. Defaults to English.

radiusMeters

Int

default: 500

Maximum search radius around the anchor in meters (1 to 5000).

limit

Int

default: 1

Maximum number of places to return (1 to 50).

layers

[GeocodeLayer!]

Restrict results to specific layers.

Example

query ReverseGeocode($input: ReverseGeocodeInput!) {
  reverseGeocode(input: $input) {
    point
    places {
      name
      label
      layer
      category
    }
  }
}

ReverseGeocodeResult echoes the point and returns a places list of the same Place shape as geocode, ordered by proximity then relevance.

pois

List points of interest matching one or more categories, inside either a bounding box or a buffered geometry. When a buffered area is used, each POI is annotated with its distance to the geometry.

Input

pois(input: POIsInput!)

categories

[POICategory!]!

required

POI categories to include (1 to 10).

bbox

[Float!]

[minLon, minLat, maxLon, maxLat] search box. Mutually exclusive with buffered.

buffered

BufferedAreaInput

A GeoJSON geometry plus a bufferMeters distance (1 to 5000) that expands it into a search area. Mutually exclusive with bbox.

language

Language

Biases result names. Defaults to English.

limit

Int

default: 50

Maximum number of POIs to return (1 to 50).

The categories filter accepts these values:

CategoryDescription
HUTMountain hut or refuge providing shelter and meals.
PEAKMountain summit or peak.
PASSMountain pass or col between valleys.
VIEWPOINTScenic viewpoint or panorama spot.
PARKINGParking area for vehicles, often at a trailhead.
WATER_SOURCEDrinkable water source such as a spring or fountain.
CAFECafe or coffee shop.
RESTAURANTRestaurant serving meals.
SUPERMARKETSupermarket or grocery store.
PHARMACYPharmacy or chemist.
TOILETSPublic toilets.
CAMPSITECampsite or camping pitch.
SHELTERBivouac shelter or emergency refuge with no staff.
CABLE_CARCable car, gondola, or chairlift station.
BUS_STATIONBus station or major bus stop.
TRAIN_STATIONTrain station.
AIRPORTAirport or airfield.
ACCOMMODATIONHotel, hostel, guest house, or chalet.
CARAVAN_SITECaravan or camper site.
HOSPITALHospital.

Example

query Pois($input: POIsInput!) {
  pois(input: $input) {
    count
    pois {
      name
      category
      point
      elevation
      distanceMeters
    }
  }
}

Response

POIsResult carries count and a pois list. Each POI includes name, category, point, optional elevation (meters above sea level), selected OSM tags, and, when a buffered area was used, distanceMeters from the geometry. Admin context (country, region, city) is included when resolved.

Run one full-text query across several targets at once. Each target is opt-in, runs concurrently, and degrades gracefully: a target that fails leaves its section null and reports an entry in errors, while the others still return. Owned-entity targets (itineraries, collections, zones) return only entities the calling credential may view.

Input

search(input: SearchInput!)

query

String!

required

Search text, 1 to 200 characters after trimming.

targets

SearchTargetsInput!

required

Per-target enable flags. Every flag defaults to false, so set at least one of places, pois, ways, itineraries, collections, or zones to true.

language

Language

Biases result names. Defaults to English.

limit

Int

default: 8

Per-target maximum number of results (1 to 50).

focus

[Float!]

[longitude, latitude] center that biases the places, pois, and ways targets.

bbox

[Float!]

Bounding box that restricts the places, pois, and ways targets.

activity

ActivitySlug

Filters and ranks the ways target. Ignored unless targets.ways is true.

search also accepts a pois category list and a categories filter that apply to those targets, mirroring the pois and geocode inputs.

Example

query Search($input: SearchInput!) {
  search(input: $input) {
    query
    places {
      count
      places {
        name
        label
      }
    }
    itineraries {
      count
      itineraries {
        id
        name
        activitySlug
      }
    }
    errors {
      target
      code
      message
    }
  }
}

Response

SearchResult echoes the query and targets, then carries one section per enabled target (places, pois, ways, itineraries, collections, zones). A section is null when its target was disabled or its branch failed. The errors list holds one SearchTargetError (target, code, message) per failed branch, and is empty when every enabled branch succeeded.

Next steps