<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Don't know, if I understood you well, but maybe you are looking for something like this (associates lines to points based on the smallest distance; if you want it the other way around (points to lines) just replace t1 with t2 inside DISTINCT ON clause):</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><div style="background-color:rgb(47,47,47);padding:0px 0px 0px 2px"><div style="color:rgb(170,170,170);background-color:rgb(47,47,47);font-family:"Monospace";font-size:10pt;white-space:pre"><p style="margin:0px"><span style="color:rgb(115,158,202);font-weight:bold">with</span></p><p style="margin:0px"><span style="color:rgb(158,158,158)">t</span> <span style="color:rgb(115,158,202);font-weight:bold">as</span> ( <span style="color:rgb(102,151,104)">--making test dataset</span></p><p style="margin:0px"><span style="color:rgb(115,158,202);font-weight:bold">select</span> <span style="color:rgb(158,158,158)">gs</span></p><p style="margin:0px"> ,<span style="color:rgb(193,170,108);font-weight:bold">ST_MakePoint</span>(<span style="color:rgb(193,170,108);font-weight:bold">random</span>()*<span style="color:rgb(192,192,192)">10</span>,<span style="color:rgb(193,170,108);font-weight:bold">random</span>()*<span style="color:rgb(192,192,192)">10</span>) <span style="color:rgb(115,158,202);font-weight:bold">as</span> <span style="color:rgb(158,158,158)">p</span></p><p style="margin:0px"> ,<span style="color:rgb(193,170,108);font-weight:bold">ST_MakeLine</span>(<span style="color:rgb(193,170,108);font-weight:bold">ST_MakePoint</span>(<span style="color:rgb(193,170,108);font-weight:bold">random</span>()*<span style="color:rgb(192,192,192)">10</span>,<span style="color:rgb(193,170,108);font-weight:bold">random</span>()*<span style="color:rgb(192,192,192)">10</span>),<span style="color:rgb(193,170,108);font-weight:bold">ST_MakePoint</span>(<span style="color:rgb(193,170,108);font-weight:bold">random</span>()*<span style="color:rgb(192,192,192)">10</span>,<span style="color:rgb(193,170,108);font-weight:bold">random</span>()*<span style="color:rgb(192,192,192)">10</span>)) <span style="color:rgb(115,158,202);font-weight:bold">as</span> <span style="color:rgb(158,158,158)">l</span></p><p style="margin:0px"><span style="color:rgb(115,158,202);font-weight:bold">from</span> <span style="color:rgb(193,170,108);font-weight:bold">generate_series</span>(<span style="color:rgb(192,192,192)">1</span>,<span style="color:rgb(192,192,192)">100</span>) <span style="color:rgb(158,158,158)">gs</span></p><p style="margin:0px"> )</p><p style="margin:0px"><span style="color:rgb(115,158,202);font-weight:bold">select</span> <span style="color:rgb(115,158,202);font-weight:bold">distinct</span> <span style="color:rgb(115,158,202);font-weight:bold">on</span> (<span style="color:rgb(158,158,158)">t1</span>.<span style="color:rgb(158,158,158)">gs</span>)</p><p style="margin:0px"> <span style="color:rgb(158,158,158)">t1</span>.<span style="color:rgb(158,158,158)">gs</span></p><p style="margin:0px"> ,<span style="color:rgb(158,158,158)">t2</span>.<span style="color:rgb(158,158,158)">gs</span></p><p style="margin:0px"> ,<span style="color:rgb(158,158,158)">ST_Distance</span>(<span style="color:rgb(158,158,158)">t1</span>.<span style="color:rgb(158,158,158)">p</span>,<span style="color:rgb(158,158,158)">t2</span>.<span style="color:rgb(158,158,158)">l</span>) <span style="color:rgb(158,158,158)">dist</span></p><p style="margin:0px"><span style="color:rgb(115,158,202);font-weight:bold">from</span> <span style="color:rgb(158,158,158)">t</span> <span style="color:rgb(158,158,158)">t1</span></p><p style="margin:0px"> , <span style="color:rgb(158,158,158)">t</span> <span style="color:rgb(158,158,158)">t2</span></p><p style="margin:0px"><span style="color:rgb(115,158,202);font-weight:bold">order</span> <span style="color:rgb(115,158,202);font-weight:bold">by</span> <span style="color:rgb(158,158,158)">t1</span>.<span style="color:rgb(158,158,158)">gs</span>,<span style="color:rgb(158,158,158)">dist</span></p></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">czw., 31 sie 2023 o 15:11 William Roper <<a href="mailto:roper.william@gmail.com">roper.william@gmail.com</a>> napisał(a):<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>ST_DumpPoints [1] perhaps?</div><div><br></div><div>[1] <a href="https://postgis.net/docs/en/ST_DumpPoints.html" target="_blank">https://postgis.net/docs/en/ST_DumpPoints.html</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 31 Aug 2023 at 13:52, 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">In a geospatial dataset, there are numerous objects. Some points must be associated with a line. Do we have a function to check out?<div>Regards,</div><div>David</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>
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>