<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 15 May 2020 at 12:56, 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">Hi, Nicolas,<div><br></div><div>Thanks.</div><div><br></div><div>That is very interesting.  I will test it.</div><div><br></div><div>I could not find information on how distance is defined.  0.01 stands on what unit?</div><div><br></div></div></blockquote><div><br></div><div>In the unit of your spatial reference system (see its wkt or proj4 definition in spatial_ref_sys table to figure out the SRS unit)</div><div> <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"><div></div><div><a href="https://postgis.net/docs/ST_DWithin.html" target="_blank">https://postgis.net/docs/ST_DWithin.html</a> </div><div><br></div><div>Regards,</div><div><br></div><div>Shao</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 15 May 2020 at 11:32, Nicolas Ribot <<a href="mailto:nicolas.ribot@gmail.com" target="_blank">nicolas.ribot@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"><div>Hi,</div><div><br></div><div>You can test for proximity between start and end points</div><div>Create spatial indexes on st_startpoint(geom) and st_endpoint(geom) on your line features table (also index starting and ending points column in table one)</div><div><br></div><div><span style="font-family:monospace">select <a href="http://t.id" target="_blank">t.id</a>, <a href="http://r.id" target="_blank">r.id</a>, r.geom</span></div><div><span style="font-family:monospace">from start_end_table t join roads r on st_dwithin(t.startpoint, st_startpoint(r.geom), 0.01) and st_dwithin(t.endpoint, st_endpoint(r.geom), 0.01)</span></div><div><br></div><div>Adjust the 0.01 distance according to your data and their precision.</div><div><br></div><div>Nicolas<br> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 15 May 2020 at 11:42, Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com" target="_blank">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">Given 2 tables.  One has the starting and ending points of roads, and the other has line features.  How best to do spatial linking or selection of road features?<div><br></div><div>Can anyone enlighten me?</div><div><br></div><div>Regards,</div><div><br></div><div>Shao</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></blockquote></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></blockquote></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></blockquote></div></div>