<div dir="ltr">First you would have to define what valid directionality is. <div><br></div><div>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 east-west.<div><br></div><div>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.</div><div><br></div><div>I'm sure there are other definitions of valid directionality, these are just two that I have come across in my work.</div><div><br></div><div>Rich</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 25, 2023 at 4:10 AM Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com">shishaozhong@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">How best to check and validate directionality of road lines?<div><br></div><div>Regards,</div><div><br></div><div>David</div></div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Richard W. Greenwood<br><a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a></div></div>