[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Is there any way to find and select parallel lines in 3D?
From:       Shaozhong SHI <shishaozhong () gmail ! com>
Date:       2022-02-25 13:49:20
Message-ID: CA+i5Jwa1byaQ78A4KOKK6w_JUuXj+hp4gs_aLB55GyaSpTEarg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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-i=
n-three-dimensional-space>*
>
> pt., 25 lut 2022 o 11:36 Shaozhong SHI <shishaozhong@gmail.com>
> napisa=C5=82(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 paralle=
l
>> 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@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@gmail.com>
>>> napisa=C5=82(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@lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr"><div>I tried to the following \
code.</div><div><br></div><div>with links as (select fid, geometry as geom from \
zigzaglines)</div><div>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)</div><div><br></div><div>It does pick up lines in set \
proximity.</div><div><br></div><div>However, it can not tell whether 2 zigzag lines \
are in approximate parallel.</div><div><br></div><div>This script picks up other \
lines in set proximity.</div><div><br></div><div>Regards,</div><div><br></div><div>David</div><div><br></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 25 Feb 2022 at 11:39, \
Marcin Mionskowski &lt;<a \
href="mailto:mionskowskimarcin@gmail.com">mionskowskimarcin@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
class="gmail_default" style="font-family:monospace"><code><b>Have a look at <a \
href="https://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions" \
target="_blank">https://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions</a></b></code></div><div \
class="gmail_default" style="font-family:monospace"><code><b><code><b>especially \
ST_3DDWithin and <code><b>ST_3DDFullyWithin.<br></b></code></b></code></b></code></div><div \
class="gmail_default" \
style="font-family:monospace"><code><b>ST_Intersects(geomA,ST_Buffer(geomB,tolerance)) \
is basically the same as ST_DWithin(geomA,geomB,tolerance).</b></code></div><div \
class="gmail_default" style="font-family:monospace"><code><b>And for segments, I \
can&#39;t explain it better than first hit of duckduckgo search for 3d lines parallel \
<a href="https://socratic.org/questions/how-do-i-know-if-two-lines-are-parallel-in-three-dimensional-space" \
target="_blank">https://socratic.org/questions/how-do-i-know-if-two-lines-are-parallel-in-three-dimensional-space</a></b></code></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">pt., 25 lut 2022 o 11:36  \
Shaozhong SHI &lt;<a href="mailto:shishaozhong@gmail.com" \
target="_blank">shishaozhong@gmail.com</a>&gt; napisał(a):<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Is there any example of \
implementation for segments to have a look at?<div><br></div><div>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.</div><div><br></div><div>Is \
there any equivalent to ST_Buffer for dealing with 3D \
objects?</div><div><br></div><div>Regards,</div><div><br></div><div>David</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 25 Feb 2022 at 09:30, \
Marcin Mionskowski &lt;<a href="mailto:mionskowskimarcin@gmail.com" \
target="_blank">mionskowskimarcin@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" \
style="font-family:monospace">It&#39;s easy for segments. Just use general math \
approach (for example first hit with duckduckgo search for line equation 3d - <a \
href="https://www.geeksforgeeks.org/equation-of-a-line-in-3d/" \
target="_blank">https://www.geeksforgeeks.org/equation-of-a-line-in-3d/</a>).</div><div \
class="gmail_default" style="font-family:monospace"><span lang="en"><span><span>This \
is not so simple for line<span lang="en"><span><span>strings</span></span></span> \
composed from multiple segments</span></span></span>. For exapmle, are the following \
lines parallel?<br></div><div class="gmail_default" \
style="font-family:monospace">select ST_GeomFromText(&#39;LINESTRING(0 0 0,0 0 \
4)&#39;) geomA<br>	,ST_GeomFromText(&#39;LINESTRING(0 -1 0,1 0 1,0 1 2,-1 0 3,0 -1 \
4)&#39;) geomB</div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">czw., 24 lut 2022 o 10:53  Shaozhong SHI &lt;<a \
href="mailto:shishaozhong@gmail.com" target="_blank">shishaozhong@gmail.com</a>&gt; \
napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
dir="ltr">The following is interesting.<div><br></div><div><a \
href="https://gis.stackexchange.com/questions/224937/how-to-select-parallel-lines-in-postgis" \
target="_blank">How to select parallel lines in postgis - Geographic Information \
Systems Stack Exchange</a><br></div><div><br></div><div>However, it appears to be \
full 2D lines.</div><div><br></div><div>Are there any solutions to find and select \
parallel lines in 3D?</div><div><br></div><div>Regards,</div><div><br></div><div>David</div></div></div>
 _______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div> _______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div> _______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div> _______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div>



_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic