Skip to content
GuidesPlaygroundDashboard

Find features near a geographic point

client.Elements.Nearby(ctx, query) (*FeatureCollection, error)
GET/api/v1/features/nearby

Find features near a geographic point

ParametersExpand Collapse
query ElementNearbyParams
Lat param.Field[float64]

Latitude (-90 to 90)

Lng param.Field[float64]

Longitude (-180 to 180)

Limit param.Field[int64]optional

Maximum results (default 20, max 100)

Radius param.Field[int64]optional

Search radius in meters (default 500, max 10000)

ReturnsExpand Collapse
type FeatureCollection struct{…}

Bare GeoJSON FeatureCollection. Pagination metadata is returned in HTTP headers (X-Limit, X-Has-More, X-Next-Cursor, X-Next-Offset, Link).

Features []GeoJsonFeature
Coordinates GeoJsonGeometryCoordinatesUnion

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
type GeoJsonGeometryCoordinatesArray []float64
type GeoJsonGeometryCoordinatesArray [][]float64
type GeoJsonGeometryCoordinatesArray [][][]float64
type GeoJsonGeometryCoordinatesArray [][][][]float64
Type GeoJsonGeometryType
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 map[string, unknown]
Type GeoJsonFeatureType
ID stringoptional

Feature identifier (type/osm_id)

OsmID int64optional

OpenStreetMap ID

Type FeatureCollectionType

Find features near a geographic point

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"),
  )
  featureCollection, err := client.Elements.Nearby(context.TODO(), githubcomplazafyiplazago.ElementNearbyParams{
    Lat: githubcomplazafyiplazago.F(0.000000),
    Lng: githubcomplazafyiplazago.F(0.000000),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", featureCollection.Features)
}
Returns Examples