Skip to content
GuidesPlaygroundDashboard

Forward geocode an address

client.geocode.forward(GeocodeForwardParams { q, bbox, country_code, 5 more } query, RequestOptionsoptions?): GeocodeResult { features, type }
GET/api/v1/geocode

Forward geocode an address

ParametersExpand Collapse
query: GeocodeForwardParams { q, bbox, country_code, 5 more }
q: string

Address or place name

bbox?: string

Bounding box filter: south,west,north,east

country_code?: string

ISO 3166-1 alpha-2 country code filter

lang?: string

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

lat?: number

Focus latitude

layer?: string

Filter by layer: address, poi, or admin

limit?: number

Maximum results (default 20, max 100)

lng?: number

Focus longitude

ReturnsExpand Collapse
GeocodeResult { features, type }

GeoJSON FeatureCollection of geocoding results

features: Array<GeocodingFeature { geometry, properties, type } >
geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties { country_code, display_name, distance_m, 4 more }
country_code?: string | null

ISO 3166-1 alpha-2 country code

display_name?: string

Formatted address or place name

distance_m?: number | null

Distance in meters

osm_id?: number | null

OpenStreetMap ID

osm_type?: string | null

OSM element type

score?: number | null

Match confidence score

source?: string | null

Result source (address, place, interpolation)

type: "Feature"
type: "FeatureCollection"

Forward geocode an address

import Plaza from '@plazafyi/sdk';

const client = new Plaza({
  apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted
});

const geocodeResult = await client.geocode.forward({ q: 'q' });

console.log(geocodeResult.features);
Returns Examples