[postgis-users] Spatial linking or selection
Bo Victor Thomsen
bo.victor.thomsen at gmail.com
Fri May 15 04:19:25 PDT 2020
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 <nicolas.ribot at gmail.com
> <mailto: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 <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
> <shishaozhong at gmail.com <mailto: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
> <mailto:postgis-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org <mailto: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
--
Med venlig hilsen / Kind regards
Bo Victor Thomsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200515/6e44b837/attachment.html>
More information about the postgis-users
mailing list