Hi,
I was trying to use the Traffic Incident API for Germany. I made the boundingbox bottom left Stuttgard (48.786841, 9.186765( 4878684.1, 9186765)) and the top right Berlin(52.523352, 13.444267(5252335.2, 13444267)) The API call was sucessful, but not correct! It started showing me Data outside the box. Like to the right of it perfectly. How do I show the Incidents INSIDE the Box?
Thank you.
Hi.
Please take a look at our Traffic Tutorial which covers your issue. Also you might take a look at the previous post on the similar topic here: Zoom in Traffic incidents.
Regards,
Mateusz
Hi thanks for the quick answer.
I’m not using the web application. I just want a JSON output that gives me the traffic incidents in Germany. Does the API only work in your web application?
If not then continue reading:
https://api.tomtom.com/traffic/services/4/incidentDetails/night/4945193.81111%2C7859178.11111%2C5160255.211111%2C1032083.11111/22/-1/json?key=
The Coordinates are 49.451938, 7.859178 and 51.602552, 10.320831
I used the 22 zoom. This should show the traffic details of a state in Germany. But the response are details which are not in the coordinates.
Thx @szczepam
So this was my attempt. Do you see anything wrong?
I’ll try to reproduce your issue and come back to you with any results.
Regards,
Mateusz
Hi.
Unfortunately, we can’t reproduce your problem. Is it possible for you to double-check your call and received incidents with the additional parameter geometries=original
, decode your geometries and make sure that none of them are outside your bounding box? Please keep in mind that even if a little part of the incident geometry is inside the bounding box, the whole incident will be returned as it would be inside it. It’s a typical problem which has been explained and covered by the Traffic Tutorial mentioned in one of the above posts.
Let me know if you’ll have more questions.
Regards,
Mateusz
Hi.
Found it . Simple Mistake:
https://api.tomtom.com/traffic/services/4/incidentDetails/night/4945193.81111%2C785917.811111%2C5160255.211111%2C1032083.11111/22/-1/json?key=
I had to move the decimal of minlong one digit before.
Now it shows me data inside the bounding box.
I’ve used a similar bounding box that covers all of germany.
https://api.tomtom.com/traffic/services/4/incidentDetails/night/4756466.60000%2C570000.00000%2C5540000.00000%2C1500000.00000/22/-1/json?key=
This works semidecent. There are Coordinates like 6.586000 and 55.111100 (rounded), which are in the ocean. That does not make sense. Furthermore some areas are just not covered e.g. the western regions of Germany e.g. Cologne. Can you explain to me why some coordinates are a bit off and why some areas of germany are not covered?
Thanks for all your hard work @szczepam. I appreciate your effort and your help.