[postgis-users] Spatial linking or selection
Nicolas Ribot
nicolas.ribot at gmail.com
Fri May 15 03:29:05 PDT 2020
Hi,
You can test for proximity between start and end points
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)
select t.id, r.id, r.geom
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)
Adjust the 0.01 distance according to your data and their precision.
Nicolas
On Fri, 15 May 2020 at 11:42, Shaozhong SHI <shishaozhong at gmail.com> wrote:
> 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?
>
> Can anyone enlighten me?
>
> Regards,
>
> Shao
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200515/ef9a6c8d/attachment.html>
More information about the postgis-users
mailing list