[postgis-users] Spatial linking or selection

Shaozhong SHI shishaozhong at gmail.com
Fri May 15 03:50:17 PDT 2020


Hi, Nicolas,

Thanks.

That is very interesting.  I will test it.

I could not find information on how distance is defined.  0.01 stands on
what unit?

https://postgis.net/docs/ST_DWithin.html

Regards,

Shao

On Fri, 15 May 2020 at 11:32, Nicolas Ribot <nicolas.ribot at gmail.com> wrote:

> 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
>
> _______________________________________________
> 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/c84a457a/attachment.html>


More information about the postgis-users mailing list