Routing Geolocation to fixed location

For a first year school project, I want to build a wayfinder for new students to find our campus.
So I need to make a route from point A (current geolocation) to point B (fixed location/campus coordinates).
This is all still a bit tricky and new for me to find out and I couldn’t find any documentation or tutorial about this.

Would be great if someone could guide me a bit along the way!
Thanks!

Tutorials are here:

and here:

and here:

and here:

I work with the iOS SDK. There’s a class LocationManager which tracks the location updates. I get the lastLocation from here to know the current location of the user.

Once you have the user’s current location, you have the minimum 2 points required to draw the route.

Hope these help you to get started with the project, Michiel!

1 Like

Thank you! Though I’ve came a cross most of these tutorials, I’m still kinda lost how I merge the two parts (being current and fixed location)

You could take this example: https://developer.tomtom.com/maps-sdk-web-js-public-preview/functional-examples#examples,map,routing-ab.html
and remove the part for the ‘finish’ point and just hardcode coordinates for the finalPos

1 Like

I’ll give it a try tomorrow! Thanks in advance

Hey, sorry for bothering. I’m still stuck on it. Whenever I try and load it on my hosting I get a blank page.

!

404 are caused by missing files - you can find them in zip files (could be found on the download page).

The last error is too generic.
I hope that you try to use tt after the libraries are imported.

I imported the missing files. But I’m still getting the tt error!

can you show the order of js files imported in html?

I don’t see SDK added. Also replace the image with the code - it’s showing your API key.

<script src='https://api.tomtom.com/maps-sdk-for-web/cdn/6.x/6.1.2-public-preview.15/maps/maps-web.min.js'></script>
<script src='https://api.tomtom.com/maps-sdk-for-web/cdn/6.x/6.1.2-public-preview.15/services/services-web.min.js'></script>

These lines should be added before your script.js

I’ve added the lines, now I’m getting a dragpan error (but I guess this isn’t the end of the world). Why am I still seeing no map?

You need to import this additional js or just remove that line.

Really don’t know what I’m doing wrong. Still no map visable. Getting these error codes that point to a .js that isn’t included? :confused:

Do you have an element in HTML with “map” id?

Okay! Great! I’ve managed to finally load the code onto my hosting and am able to use it the same way as the A-B route example. Which already feels amazing to be honest haha.