Quantifying Traffic Flow for a Specific Area

Hi, I am trying to acquire the traffic flow for a specific area defined by Lat,and Long points. this is in the shape of a bound box. My idea for this is to have the roads in this specific area, quantity the traffic on that road. I can see this is possible with TomTom with the Traffic Flow API but the problem with that is that it will only do one road or section of a road per request and i cant think of a reasonable way to use the Traffic Flow API to to continuously requests it for every road in the defined area without over computing. Is there a better product alternative that TomTom offers?

You could try to read the info straight from vector tiles.
They cost a way less than Flow Segment Data.

1 Like

what do you mean by cost less?

Flow Segment Data is charged by 1 transaction.
Tiles are charged by 1/15 transaction.

1 Like

oh wow i didnt know that. Thank you for the advice. are you able to set the size of tile to a certain radius using Longitude and Latitude?

You need to calculate x/y/z. The documentation describing that: https://developer.tomtom.com/maps-api/maps-api-documentation/zoom-levels-and-tile-grid

1 Like

How would you read the info from vector tiles?
Can you give an example?
How do you decode or deserialize a *.pbf file?
Thank you.

Libraries for different languages are available here: https://github.com/protocolbuffers/protobuf

If you want to just decode one file: protoc --decode vector_tile.Tile Vector_Tile.proto < tmp.pbf
where tmp.pbf is your downloaded pbf file.

Great topic.
I guess that I can extend this approach to calculate the traffic on a given city, for example?
Or there is another way to get this information already calculated through the API?

I’m new to the API, I would be glad to any feedback from you experienced users.

Take a look at our Traffic Stats API. Maybe it will be interesting for you. Although it requires a custom contract.


Thank you very much for your prompt reply, very helpful!

You’re welcome :wink: