Add extra waypoints to waypoints-optimization script

Hello,

I would like to add some extra waypoints to the following script:
https://api.tomtom.com/maps-sdk-js/latest/examples/waypoints-optimization.html

  • Can this be done by using textfields and then import zipcode/adres one at a time? Sample: https://www.snelsteroute.nl/
  • Can this be done with CSV upload?

Hope there is a solution!

Fred

Hello Fred!

I see you are looking at the sample for the Web SDK V4. ( https://developer.tomtom.com/maps-sdk-web/functional-examples#waypoints-optimization)
We are already working on new ones for the latest SDK ( Version 5 ).

But to answer your question, you can always take the example coode ( There is a zip file download ) and update the code to read a JavaScript file with the new location. If you only have addresses, I’d pre-process the list first with Geocoding calls ( https://developer.tomtom.com/search-api/search-api-documentation-geocoding/geocode ) to get the Lat,Lng pairs.

I hope this can help and please don’t hesitate to reply to this thread if you have more questions!

-Jose

1 Like

Hello Jose,

Thnxs for your answer and tip.
What I really want is an extention of this example script.

  1. I need a extra textarea (or textfields) where customers can put their adresses with e.g. copy/paste.
  2. An insert button will put the adresses inside the code and TomTom map.
  3. The button Compute best order will find the shortest route between the inserted adresses.

Is there a way someone can rewrite the javascript for me?
I have little knowledge with javascript and geocoding.

Hope you can help me!

Fred