[postgis-users] Is there any way to find and select parallel lines in 3D?

Shaozhong SHI shishaozhong at gmail.com
Fri Feb 25 05:49:20 PST 2022


I tried to the following code.

with links as (select fid, geometry as geom from zigzaglines)
select ST_force2d(a.geom) from links a join links b on
ST_3DDFullyWithin(a.geom, b.geom, 10) AND NOT ST_3DIntersects(a.geom,
b.geom)

It does pick up lines in set proximity.

However, it can not tell whether 2 zigzag lines are in approximate parallel.

This script picks up other lines in set proximity.

Regards,

David


On Fri, 25 Feb 2022 at 11:39, Marcin Mionskowski <
mionskowskimarcin at gmail.com> wrote:

> *Have a look at
> https://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions
> <https://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions>*
>
> *especially ST_3DDWithin and ST_3DDFullyWithin.*
> *ST_Intersects(geomA,ST_Buffer(geomB,tolerance)) is basically the same as
> ST_DWithin(geomA,geomB,tolerance).*
> *And for segments, I can't explain it better than first hit of duckduckgo
> search for 3d lines parallel
> https://socratic.org/questions/how-do-i-know-if-two-lines-are-parallel-in-three-dimensional-space
> <https://socratic.org/questions/how-do-i-know-if-two-lines-are-parallel-in-three-dimensional-space>*
>
> pt., 25 lut 2022 o 11:36 Shaozhong SHI <shishaozhong at gmail.com>
> napisał(a):
>
>> Is there any example of implementation for segments to have a look at?
>>
>> For 2D lines, it is possible to ST_buffer to detect potentially parallel
>> lines.  That is useful since natural lines do not necessarily in parallel
>> exactly.
>>
>> Is there any equivalent to ST_Buffer for dealing with 3D objects?
>>
>> Regards,
>>
>> David
>>
>> On Fri, 25 Feb 2022 at 09:30, Marcin Mionskowski <
>> mionskowskimarcin at gmail.com> wrote:
>>
>>> It's easy for segments. Just use general math approach (for example
>>> first hit with duckduckgo search for line equation 3d -
>>> https://www.geeksforgeeks.org/equation-of-a-line-in-3d/).
>>> This is not so simple for linestrings composed from multiple segments.
>>> For exapmle, are the following lines parallel?
>>> select ST_GeomFromText('LINESTRING(0 0 0,0 0 4)') geomA
>>> ,ST_GeomFromText('LINESTRING(0 -1 0,1 0 1,0 1 2,-1 0 3,0 -1 4)') geomB
>>>
>>> czw., 24 lut 2022 o 10:53 Shaozhong SHI <shishaozhong at gmail.com>
>>> napisał(a):
>>>
>>>> The following is interesting.
>>>>
>>>> How to select parallel lines in postgis - Geographic Information
>>>> Systems Stack Exchange
>>>> <https://gis.stackexchange.com/questions/224937/how-to-select-parallel-lines-in-postgis>
>>>>
>>>> However, it appears to be full 2D lines.
>>>>
>>>> Are there any solutions to find and select parallel lines in 3D?
>>>>
>>>> Regards,
>>>>
>>>> David
>>>> _______________________________________________
>>>> 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
>>>
>> _______________________________________________
>> 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/20220225/d2b9dc2d/attachment.html>


More information about the postgis-users mailing list