none
Use Snap To Road API from Truck Route API response. RRS feed

  • Question

  • The snap-to-road API requires that

    1. locations are described as Points (lat/long).

    2. distance between two points should not exceed 2.5km.

    I've seen scenarios where the truck route API returns "itineraryItems" in excess of 30km. and "itineraryItems" seems the shortest metric with geo-point info.

    So how do I bridge this gap?

    I see that within "Details" (RouteLegs->ItineraryItems->Details) there's a list of "LocationCodes". Is this something I can use to convert to Geo Points?

    (The locationCode format seems similar to the Open Location Code format but I tried it and it's not compatible.)

    Friday, November 15, 2019 12:23 PM

Answers

  • I just noticed in the docs that if I specify "routeAttributes=routePath" it'll add to the response a "routePath" object which includes coordinates. 

    This is exactly what I was looking for.

    Thanks!

    • Marked as answer by Sal Mor Sunday, November 17, 2019 7:02 AM
    Sunday, November 17, 2019 7:02 AM

All replies

  • Hi Sal,

    Can you please provide more details on what you want to accomplish?  Snap to road is designed to take GPS points collected while a driver is on a route then convert those to the most likely route that the driver took.  That does not seem like what you are asking here.  Can you be more specific about the data that you have and what you would like to do with it?

    Sincerely,

    IoTGirl

    Friday, November 15, 2019 5:53 PM
    Owner
  • IoTGirl, thanks for the response.

    Okay, didn't realize the intention of Snap-To-Road API

    I'd like to use Truck Route API data to display an accurate line on a map so that users analyzing the created route can see a line that's in-sync with the given road road.

    Sunday, November 17, 2019 6:01 AM
  • I just noticed in the docs that if I specify "routeAttributes=routePath" it'll add to the response a "routePath" object which includes coordinates. 

    This is exactly what I was looking for.

    Thanks!

    • Marked as answer by Sal Mor Sunday, November 17, 2019 7:02 AM
    Sunday, November 17, 2019 7:02 AM