Skip to content
GuidesBlogPlaygroundDashboard

Reverse geocode a coordinate

client.Geocode.ReversePost(ctx, body) (*ReverseGeocodeResult, error)
POST/api/v1/geocode/reverse

Reverse geocode a coordinate

ParametersExpand Collapse
body GeocodeReversePostParams
Format param.Field[string]optional

Response format: json (default), geojson, csv, ndjson

Lang param.Field[string]optional

Language code for localized names (e.g. en, de, fr)

Lat param.Field[float64]optional

Legacy shorthand. Latitude. Use near param instead.

Layer param.Field[string]optional

Filter by layer: house or poi

Limit param.Field[int64]optional

Maximum results (default 1, max 20)

Lng param.Field[float64]optional

Legacy shorthand. Longitude. Use near param instead.

Near param.Field[string]optional

Point geometry for reverse geocode (lat,lng or GeoJSON). Alternative to lat/lng params.

Radius param.Field[int64]optional

Search radius in meters (default 200, max 5000)

ReturnsExpand Collapse
type ReverseGeocodeResult struct{…}

GeoJSON FeatureCollection of reverse geocoding results, ordered by distance from the query point. Content-Type: application/geo+json.

Features []GeocodingFeature

Reverse geocoding results ordered by distance

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

Coordinates GeoJsonGeometryCoordinatesUnion

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
type GeoJsonGeometryCoordinatesPoint []float64

[longitude, latitude] or [longitude, latitude, elevation]

type GeoJsonGeometryCoordinatesLineStringOrMultiPoint [][]float64

Array of [lng, lat] positions

type GeoJsonGeometryCoordinatesPolygonOrMultiLineString [][][]float64

Array of linear rings / line strings

type GeoJsonGeometryCoordinatesMultiPolygon [][][][]float64

Array of polygons

Type GeoJsonGeometryType

Geometry type

One of the following:
const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"
const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"
const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"
const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"
const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"
const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"
Properties GeocodingFeatureProperties

Geocoding result properties

DisplayName string

Formatted address or place name

Category stringoptional

POI category (e.g. restaurant, cafe, park). Present for place results.

City stringoptional

City or town name. Present for address results.

Confidence float64optional

Interpolation confidence (0-1). Present only for interpolated results.

maximum1
minimum0
Country stringoptional

Country name. Present for reverse geocode address results.

CountryCode stringoptional

ISO 3166-1 alpha-2 country code

maxLength2
minLength2
DistanceM float64optional

Distance from the query point in meters (reverse geocode / nearby only)

FullAddress stringoptional

Complete formatted address from the database. Present for reverse geocode address results.

HouseNumber stringoptional

House or building number. Present for address and interpolated results.

Interpolated booloptional

Whether this result was estimated by address interpolation rather than an exact database match.

Name stringoptional

Place name (raw). Present for reverse geocode place results.

OsmID int64optional

OpenStreetMap element ID (null for interpolated results)

OsmType GeocodingFeaturePropertiesOsmTypeoptional

OSM element type (node, way, relation)

One of the following:
const GeocodingFeaturePropertiesOsmTypeNode GeocodingFeaturePropertiesOsmType = "node"
const GeocodingFeaturePropertiesOsmTypeWay GeocodingFeaturePropertiesOsmType = "way"
const GeocodingFeaturePropertiesOsmTypeRelation GeocodingFeaturePropertiesOsmType = "relation"
Postcode stringoptional

Postal code. Present for reverse geocode address results.

Score float64optional

Relevance score (higher is better). Incorporates text match quality, spatial proximity boost, and popularity signals. Not bounded to 0-1.

minimum0
Source GeocodingFeaturePropertiesSourceoptional

Result source indicating how the result was found: structured (exact field match), bm25 (full-text search), fuzzy (trigram similarity), address (reverse geocode address), place (reverse geocode POI), interpolation (estimated from neighboring addresses)

One of the following:
const GeocodingFeaturePropertiesSourceStructured GeocodingFeaturePropertiesSource = "structured"
const GeocodingFeaturePropertiesSourceBm25 GeocodingFeaturePropertiesSource = "bm25"
const GeocodingFeaturePropertiesSourceFuzzy GeocodingFeaturePropertiesSource = "fuzzy"
const GeocodingFeaturePropertiesSourceAddress GeocodingFeaturePropertiesSource = "address"
const GeocodingFeaturePropertiesSourcePlace GeocodingFeaturePropertiesSource = "place"
const GeocodingFeaturePropertiesSourceInterpolation GeocodingFeaturePropertiesSource = "interpolation"
State stringoptional

State or province name. Present for reverse geocode address results.

Street stringoptional

Street name. Present for address and interpolated results.

Subcategory stringoptional

POI subcategory. Present for place results.

Tags map[string, string]optional

Raw OSM tags. Present for place results.

Wikipedia stringoptional

Wikipedia article reference (e.g. en:Eiffel Tower). Present for notable places.

Type GeocodingFeatureType
Type ReverseGeocodeResultType

Reverse geocode a coordinate

package main

import (
  "context"
  "fmt"

  "github.com/plazafyi/plaza-go"
  "github.com/plazafyi/plaza-go/option"
)

func main() {
  client := githubcomplazafyiplazago.NewClient(
    option.WithAPIKey("My API Key"),
  )
  reverseGeocodeResult, err := client.Geocode.ReversePost(context.TODO(), githubcomplazafyiplazago.GeocodeReversePostParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", reverseGeocodeResult.Features)
}
{
  "features": [
    {
      "geometry": {
        "coordinates": [
          2.3522,
          48.8566
        ],
        "type": "Point"
      },
      "properties": {
        "display_name": "221B Baker Street, London, NW1 6XE, United Kingdom",
        "category": "restaurant",
        "city": "London",
        "confidence": 0,
        "country": "United Kingdom",
        "country_code": "GB",
        "distance_m": 0,
        "full_address": "221B Baker Street, London, NW1 6XE, United Kingdom",
        "house_number": "221B",
        "interpolated": true,
        "name": "Eiffel Tower",
        "osm_id": 21154906,
        "osm_type": "node",
        "postcode": "NW1 6XE",
        "score": 0,
        "source": "structured",
        "state": "England",
        "street": "Baker Street",
        "subcategory": "italian",
        "tags": {
          "foo": "string"
        },
        "wikipedia": "en:Eiffel Tower"
      },
      "type": "Feature"
    }
  ],
  "type": "FeatureCollection"
}
Returns Examples
{
  "features": [
    {
      "geometry": {
        "coordinates": [
          2.3522,
          48.8566
        ],
        "type": "Point"
      },
      "properties": {
        "display_name": "221B Baker Street, London, NW1 6XE, United Kingdom",
        "category": "restaurant",
        "city": "London",
        "confidence": 0,
        "country": "United Kingdom",
        "country_code": "GB",
        "distance_m": 0,
        "full_address": "221B Baker Street, London, NW1 6XE, United Kingdom",
        "house_number": "221B",
        "interpolated": true,
        "name": "Eiffel Tower",
        "osm_id": 21154906,
        "osm_type": "node",
        "postcode": "NW1 6XE",
        "score": 0,
        "source": "structured",
        "state": "England",
        "street": "Baker Street",
        "subcategory": "italian",
        "tags": {
          "foo": "string"
        },
        "wikipedia": "en:Eiffel Tower"
      },
      "type": "Feature"
    }
  ],
  "type": "FeatureCollection"
}