Skip to content Skip to sidebar Skip to footer

Mapbox Geolocation, How To Load Into Map?

I have being playing around with MapBox and I am having some issues with getting the GeoLocation API to send data back to the map and update the it. This is what I got right now:

Solution 1:

The answer may lie with how you are encoding UK_ADDRESS_HERE.

https://api.mapbox.com/geocoding/v5/mapbox.places/UK_ADDRESS_HERE.json


The request format for the Mapbox Geocding API requires that since the {query} parameter can contain any value, it should be URL-encoded.

That means that a simple geocode request like 10 Downing Street, Westminster must be encoded using encodeURIComponent to 10%20Downing%20Street%2C%20Westminster.

Try this and verify that your request is proper.

curl https://api.tiles.mapbox.com/geocoding/v5/mapbox.places/10%20Downing%20Street%2C%20London.json?access_token=${MAPBOX_ACCESS_TOKEN}

Post a Comment for "Mapbox Geolocation, How To Load Into Map?"