[postgis-users] Line within range of another line?

Paul Ferro geotrekgis at gmail.com
Wed Nov 2 14:02:23 PDT 2016


Greetings,

I have a similar issue where I want join attributes by location from line A
to line B. Line B contains the attributes I'm interested to join to line A.
Line A is a continuous road network, while line B is erratic gps line
output. It some cases line A and line B intersect, but that is not always
the case. I used the join attributes by location tool in qgis and got mixed
results since the tool performs an intersect first, where I need a function
to handle both an ST_overlap and ST_buffer. I think the lines are too close
together to use ST_DWithin.

Perhaps something like this:

SELECT ST_Overlaps(a,b) As a_overlap_b, ST_Crosses(a,b) As a_crosses_b,
ST_Intersects(a, b) As a_intersects_b,
ST_Contains(b,a) As b_contains_a,
ST_Dimension(a) As dim_a, ST_Dimension(b) as dim_b,
ST_Dimension(ST_Intersection(a,b)) As dima_intersection_b
FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 0.5)'), 3)  As a,
ST_Buffer(ST_GeomFromText('LINESTRING(1 0, 1 1, 3 5)'),0.5)  As b)
As foo;

Will the attributes carry over to the output?

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20161102/7f96b85d/attachment.html>


More information about the postgis-users mailing list