Parse and geocode addresses
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 // }
async function validateAddress(address: string) { try { const parsed = await services.geo.parseAddress({ address }); return { valid: true, parsed }; } catch (error) { return { valid: false, error: "Invalid address" }; } }