Skip to content
GuidesPlaygroundDashboard

Forward geocode an address

client.Geocode.Forward(ctx, query) (*GeocodeResult, error)
GET/api/v1/geocode

Forward geocode an address

ParametersExpand Collapse
query GeocodeForwardParams
Q param.Field[string]

Address or place name

Bbox param.Field[string]optional

Bounding box filter: south,west,north,east

CountryCode param.Field[string]optional

ISO 3166-1 alpha-2 country code filter

Lang param.Field[string]optional

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

Lat param.Field[float64]optional

Focus latitude

Layer param.Field[string]optional

Filter by layer: address, poi, or admin

Limit param.Field[int64]optional

Maximum results (default 20, max 100)

Lng param.Field[float64]optional

Focus longitude

ReturnsExpand Collapse
type GeocodeResult struct{…}

GeoJSON FeatureCollection of geocoding results

Features []GeocodingFeature
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 GeocodingFeatureProperties
CountryCode stringoptional

ISO 3166-1 alpha-2 country code

DisplayName stringoptional

Formatted address or place name

DistanceM float64optional

Distance in meters

OsmID int64optional

OpenStreetMap ID

OsmType stringoptional

OSM element type

Score float64optional

Match confidence score

Source stringoptional

Result source (address, place, interpolation)

Type GeocodingFeatureType
Type GeocodeResultType

Forward geocode an address

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"),
  )
  geocodeResult, err := client.Geocode.Forward(context.TODO(), githubcomplazafyiplazago.GeocodeForwardParams{
    Q: githubcomplazafyiplazago.F("q"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", geocodeResult.Features)
}
Returns Examples