How to automatically determine what is direction1 and direction2?

31 views
Skip to first unread message

Yury Kostov

unread,
Sep 19, 2025, 5:16:39 AM9/19/25
to road.digitraffic.fi
Trying to use TMS API: /api/tms/v1/stations/data
Lets get some station, sensor 5022, for example. This is 5 min average speed for "direction1". What means "direction1"? Can I use locations API (/api/traffic-message/v1/locations) to automatically determine directions with help of  "negOffset" and "posOffset" values, where "positive" means "direction1"? 

Digitraffic support / Solita / Jouni

unread,
Sep 19, 2025, 6:08:52 AM9/19/25
to road.digitraffic.fi

Hi,

Thanks for the question.

SUUNTA1 and SUUNTA2 in name of station means direction related to the road register address increasing direction.

You can get metadata of sensors from Digitraffic API/api/tms/v1/sensors. That API has a field called "directionand it has description:

Road station sensor direction
UNKNOWN: 0 = Unknown direction.
INCREASING_DIRECTION: 1 = According to the road register address increasing direction. I.e. on the road 4 to Rovaniemi.
DECREASING_DIRECTION: 2 = According to the road register address decreasing direction. I.e. on the road 4 to Helsinki.

Enum:
[ UNKNOWN, INCREASING_DIRECTION, DECREASING_DIRECTION ]

The API you mentioned Traffic message V1 - /api/traffic-message/v1/locations is only related to traffic messages and not TMS stations or sensors.

There is also api /api/tms/v1/stations/sensor-constants where you can find "Tien_suunta" value for most of the stations and use that for direction 1 as compass direction.

I hope this helps.

Ystävällisin terveisin / Best regards
– Digitraffic asiakastuki / Digitraffic support / Jouni –

Yury Kostov

unread,
Sep 19, 2025, 6:18:49 AM9/19/25
to road.digitraffic.fi
Thank you!
Is there a way to automatically (in program) determine address increasing direction?
пятница, 19 сентября 2025 г. в 17:08:52 UTC+7, Digitraffic support / Solita / Jouni:

Yury Kostov

unread,
Sep 19, 2025, 6:26:46 AM9/19/25
to road.digitraffic.fi
There is also api /api/tms/v1/stations/sensor-constants where you can find "Tien_suunta" value for most of the stations and use that for direction 1 as compass direction.

Sorry, this is what I wont!
Thanks again.

пятница, 19 сентября 2025 г. в 17:18:49 UTC+7, Yury Kostov:

Yury Kostov

unread,
Sep 22, 2025, 11:50:05 PM9/22/25
to road.digitraffic.fi
stations.json:
```
"id" : 23015,
    "geometry" : {
      "type" : "Point",
      "coordinates" : [ 26.173444, 60.615872, 0.000000 ]
    },
```
sensor-constants.json (for this station, 23015):
```
      "name" : "Tien_suunta",
      "value" : 20,
      "validFrom" : "01-01",
      "validTo" : "12-31"
```
But if we look at the map:
https://www.google.com/maps/place/60%C2%B036'57.1%22N+26%C2%B010'24.4%22E/@60.615872,26.1708691,17z/data=!4m4!3m3!8m2!3d60.6158611!4d26.1734444?entry=ttu&g_ep=EgoyMDI1MDkxNy4wIKXMDSoASAFQAw%3D%3D
-- is it possible the direction is 20 degrees?
пятница, 19 сентября 2025 г. в 17:26:46 UTC+7, Yury Kostov:

Digitraffic support / Solita / Jouni

unread,
Oct 22, 2025, 6:45:10 AM10/22/25
to road.digitraffic.fi
Hi,

sorry for late reply. It seems that for some stations the direction is not so accurate and some are also missing the value.

We send a message to source system to check them.

Ystävällisin terveisin / Best regards
– Digitraffic asiakastuki / Digitraffic support / Jouni –

Yury Kostov

unread,
Oct 22, 2025, 6:46:35 AM10/22/25
to road.digitraffic.fi
Ok, thanks.

среда, 22 октября 2025 г. в 17:45:10 UTC+7, Digitraffic support / Solita / Jouni:
Reply all
Reply to author
Forward
0 new messages