Open andyfurniss4 opened 6 years ago
There has been a change since the latest release v3.1.2
you are using. The docs have been updated, but there is no current release which matches the docs (see also https://github.com/mapbox/mapbox-gl-directions/issues/175).
If you use profile: 'walking'
instead of profile: 'mapbox/walking'
the No 'Access-Control-Allow-Origin' header
error is gone.
Or you could build the directions-plugin from master and keep using profile: 'mapbox/walking'
.
Please note that you need to set also an access token for the plugin:
var directions = new MapboxDirections({
accessToken: mapboxgl.accessToken,
unit: 'metric',
profile: 'walking',
container: 'directions',
controls: { inputs: false }
});
Additionally there is no route available for your origin and destination coordinates. You may check with the API playground if there's a route available:
Great, thank you. Changing the profile to 'walking' worked. Yes, as you say, there are no available directions for my route :(
Now that v3.1.3 is released, the documentation is correct for the current release. If this is resolved @andyfurniss4 did you want to close this?
I'm trying to set up a simple map that automatically loads directions on the load of the map. Here is my HTML & JS:
This is just giving me the following error:
What am I doing wrong? Apologies if I'm being a bit stupid, this is the first time I've using Mapbox!