[postgis-users] Check and validate directionality of road lines

Richard Greenwood richard.greenwood at gmail.com
Tue Apr 25 13:15:46 PDT 2023

First you would have to define what valid directionality is.

In some cases valid directionality might be that all roads project outward
in a cardinal direction from an origin. For example, city blocks running
north-south or east-west. In that case you could compare the X or Y
coordinates of the start and end points of a linestring to verify that they
were larger or smaller as appropriate. e.g. that a north bound road's end
point Y was greater than its starting Y. Obviously your data would have to
have an attribute that identified if a road was designated north-south or

Another definition of a valid road direction is that it is always radiating
out like branches on a tree. This is more common in rural addressing
systems. If that's your definition of "valid" then you need to create nodes
at the forks, compare these to your linestring starting points and verify
that a fork node is not at the end of a linestring.

I'm sure there are other definitions of valid directionality, these are
just two that I have come across in my work.


On Tue, Apr 25, 2023 at 4:10 AM Shaozhong SHI <shishaozhong at gmail.com>

> How best to check and validate directionality of road lines?
> Regards,
> David
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users

Richard W. Greenwood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20230425/ade4cd2c/attachment.htm>

More information about the postgis-users mailing list