Skip to main content

Parse Address

Parse a full address string into structured components and obtain geographic coordinates (latitude/longitude).

Method

services.geo.parseAddress(params);

Parameters

address
string
required
The full address string to parse

Returns

Returns a Promise with:
streetNumber
string
required
The street number
route
string
required
The street name/route
city
string
required
The city name
state
string
required
The state or province
postalCode
string
required
The postal/ZIP code
country
string
required
The country name
lat
number
required
Latitude coordinate
lng
number
required
Longitude coordinate

Example

const result = await services.geo.parseAddress({
   address: "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
});

console.log(result);
// {
//   streetNumber: "1600",
//   route: "Amphitheatre Parkway",
//   city: "Mountain View",
//   state: "CA",
//   postalCode: "94043",
//   country: "USA",
//   lat: 37.4224764,
//   lng: -122.0842499
// }