Get started

Places

Geocoding

The geocode and reverseGeocode queries of the Data API. Every request is a POST to https://data.mountaya.com/graphql with a publishable key and a session token: see Authentication.

geocode

POST
/graphql

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

Arguments

input

GeocodeInput!

required

The text to geocode, and the filters that narrow where and what it may match.

Returns

geocode

GeocodeResult!

required

Result of a forward geocoding query.

Errors A field the API refuses is answered 200, its entry in errors beside the data that resolved. See Errors.

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query Geocode($input: GeocodeInput!) { geocode(input: $input) { count places { label name point } } }",
    "variables": {
      "input": {
        "focus": [6.8712, 45.9231],
        "limit": 3,
        "query": "Chamonix"
      }
    }
  }'

reverseGeocode

POST
/graphql

Reverse geocode a [longitude, latitude] point into a list of named places. Returns the place closest to the point, optionally constrained by layer or radius. A failure of the geocoder, its refusal of a lookup included, is INTERNAL_ERROR, never the caller's to fix.

Arguments

input

ReverseGeocodeInput!

required

The position to name, and the filters that decide which kinds of place may answer.

Returns

reverseGeocode

ReverseGeocodeResult!

required

Result of a reverse geocoding query.

Errors A field the API refuses is answered 200, its entry in errors beside the data that resolved. See Errors.

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query ReverseGeocode($input: ReverseGeocodeInput!) { reverseGeocode(input: $input) { count places { layer name } } }",
    "variables": {"input": {"limit": 2, "point": [6.9271, 45.9822]}}
  }'