It is explained on the same web page you're referring to: https://postgis.net/docs/ST_DWithin.html

For geometry: the distance unit of the geometries's srid (Coordinate reference system) . The line and point geometry must have the same srid

for geography: meters.

Den 15-05-2020 kl. 12:50 skrev Shaozhong SHI:
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 <[email protected] <mailto:[email protected]>> 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 <http://t.id>, r.id <http://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
    <[email protected] <mailto:[email protected]>> 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
        [email protected]
        <mailto:[email protected]>
        https://lists.osgeo.org/mailman/listinfo/postgis-users

    _______________________________________________
    postgis-users mailing list
    [email protected] <mailto:[email protected]>
    https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

--
Med venlig hilsen / Kind regards

Bo Victor Thomsen

_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to