Map UI Component - Geolocation based on address of customer

Hello,

I’ve been trying to implement a Map on a customer overview page that places a marker on the map based on the customer’s address and zip code(if needed). So far, all usage of the geolocation API I have seen has used the getCurrentPosition() method.

Does anyone know of a way to automatically place a marker on the map based on a customer’s address and not through the getCurrentPosition() method? :slightly_smiling_face:

Hello!

Google has a Geocoding API that is free (up until a certain amount of requests) accepting addresses as input and giving you longitude / latitude back.

You may actually see an example of this in the action “Find locations” in this App in Showroom:

Hope that helps!

1 Like

I’m using Mapbox for this. You’ll have 100.000 free queries per month. My request looks like this:

return `https://api.mapbox.com/geocoding/v5/mapbox.places/${address}%20${postal_number}%20${postal_place}.json`

Result mapping:

You’ll need to set up an account to get the access token.

1 Like

Thanks for helping out. I managed to get the MAPBOX API to work!