0

I am trying to get polyline for a route. I use valhalla turn-by-turn route API and pass multiple coordinates, but as a response I get encoded polyline for each leg, not for the whole route. Is there an option to get polyline for the route or to merge polylines of legs somehow? Thank you in advance.

prunge
  • 22,460
  • 3
  • 73
  • 80
Nane Petrosyan
  • 553
  • 1
  • 7
  • 19

1 Answers1

0

I found out that there are types for locations in valhalla API, such as break and through. When passing coordinates as a query string for the request, one must speicfy type trough if this is a transit location. By default all locations are of type break, which means valhalla creates a polyline for each leg.

Nane Petrosyan
  • 553
  • 1
  • 7
  • 19
  • Yep thats correct, if you want a single route that passes through all locations in order but you don't want to have those intermediate locations be "destinations" you should set them as `through` or as `via` (allows uturns at the location) to get a single route with a single leg and single polyline shape – Kevin Kreiser Jan 12 '22 at 01:10