TransWikia.com

Estimating direction of travel of road line segment based on long/lat in PostGIS?

Geographic Information Systems Asked by khajlk on January 19, 2021

Well, this seems pretty simple but haven’t been answered cleanly in previous relevant questions for example:

I have a large dataset of road network (multi-linestrings) of an area of interest converted to linestrings using ST_Dump(). For each linestring, I would like to estimate “the direction of travel” (north to south, east to west and vice versa) based on extracted X,Ys. Two sample linestrings are shown below.

linestring 1

linestring 2

For the above sample linestrings, ST_StartPoint() and ST_EndPoint() return the start and end points (Xs, Ys) of the same. Based on these X,Ys (long/lat), how do I estimate the direction of travel of these linestrings?

UPDATE

Assuming that I have my area of interest in the northern hemisphere. Following diagram may “represent” the “direction of travel” (from north to south).

"direction of travel" in the first case

One Answer

Answered by Nicklas Avén on January 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP