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

List:       postgis-users
Subject:    Re: [postgis-users] Problem using ST_snap
From:       Åsmund_Tokheim <asmundto () gmail ! com>
Date:       2014-09-24 23:23:14
Message-ID: CAFDjuaCEA4-D2toQDicH3cH3pwRsaToFAoPgV+AKudYC_Y60jQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Alexandre

What you have to be aware of is the subtle difference between snapping to a
vertex and a geometry edge. As I understand the documentation, ST_snap will
behave differently when snapping to a ordinary linestring and the same
linestring defined with multiple redundant vertices (e.g. LINESTRING(0 0, 0
1, 0 3)). If the polygons in your table are huge and mostly straight, you
might get something closer to your intended effect by adding coordinates
along the edges of your polygons.

Åsmund

On Wed, Sep 24, 2014 at 2:04 PM, Alexandre Neto <senhor.neto@gmail.com>
wrote:

> Hi Rémi,
>
> I'm not sure If I understood your answer correctly. In the documentation
> of ST_snap() <http://postgis.org/docs/ST_Snap.html> there are some simple
> examples showing a polygon vertex snapping to a near by linestring (or it's
> vertex). Shouldn't this be the same case.
>
> The documentation says nothing about the use of geometry collections,
> maybe that's the problem?
>
> Thanks,
>
> Alexandre Neto
>
> On Wed, Sep 24, 2014 at 12:46 PM, Rémi Cura <remi.cura@gmail.com> wrote:
>
>> Hey,
>> snap is deceiptively named.
>> As far as I know It just snaps points to points (or points in geometry to
>> points in geometry).
>> For exemple, if you draw 2 square side by side, one being bigger than the
>> other, and separate theim with small distance, snap will do nothing.
>> Cheers,
>> Rémi-C
>>
>> 2014-09-24 13:41 GMT+02:00 Alexandre Neto <senhor.neto@gmail.com>:
>>
>>> Hello all,
>>>
>>> I have to tables in postgis. table one has a set of adjacent polygons
>>> that covers all my area o interest, while table to have a few polygons
>>> across the same area.
>>>
>>> Some boundaries of table 2 should snap to the table 1 polygons, but they
>>> don't.
>>>
>>> I'm trying to use st_snap to correct this, but I'm not being able to do
>>> it. There are vertices that "refuse" to change while other (just a few do).
>>> I'm already using a very big tolerance.
>>>
>>>  Therefore I need your help to see if my query looks correct or not.
>>>
>>>
>>> WITH snap_grid as
>>> (
>>> SELECT
>>>     St_Collect(f.geom) as geom
>>> FROM
>>>     table_1 as f
>>> )
>>> SELECT
>>>     r.gid, st_snap(r.geom,q.geom,10) as geom
>>> FROM
>>>     table2 as r,
>>>     snap_grid as q
>>> WHERE r.gid = 53
>>>
>>> I already tried dumping all point form the table 1 polygons, but the
>>> result is "similar".
>>>
>>> Thanks in advance,
>>>
>>> Alexandre Neto
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@lists.osgeo.org
>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi Alexandre<div><br></div><div>What you have to be aware of is the \
subtle difference between snapping to a vertex and a geometry edge. As I understand \
the documentation, ST_snap will behave differently when snapping to a ordinary \
linestring and the same linestring defined with multiple redundant vertices (e.g. \
LINESTRING(0 0, 0 1, 0 3)). If the polygons in your table are huge and mostly \
straight, you might get something closer to your intended effect by adding \
coordinates along the edges of your \
polygons.</div><div><br></div><div>Åsmund<br><div class="gmail_extra"><br><div \
class="gmail_quote">On Wed, Sep 24, 2014 at 2:04 PM, Alexandre Neto <span \
dir="ltr">&lt;<a href="mailto:senhor.neto@gmail.com" \
target="_blank">senhor.neto@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Rémi,<div><div><br></div><div>I&#39;m not \
sure If I understood your answer correctly. In the documentation of <a \
href="http://postgis.org/docs/ST_Snap.html" target="_blank">ST_snap()</a>  there are \
some simple examples showing a polygon vertex snapping to a near by linestring (or \
it&#39;s vertex). Shouldn&#39;t this be the same \
case.</div></div><div><br></div><div>The documentation says nothing about the use of \
geometry collections, maybe that&#39;s the \
problem?</div><div><br></div><div>Thanks,</div><div><br></div><div>Alexandre \
Neto</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div \
class="gmail_quote">On Wed, Sep 24, 2014 at 12:46 PM, Rémi Cura <span \
dir="ltr">&lt;<a href="mailto:remi.cura@gmail.com" \
target="_blank">remi.cura@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div><div>Hey, <br>snap is deceiptively \
named.<br></div>As far as I know It just snaps points to points (or points in \
geometry to points in geometry).<br></div>For exemple, if you draw 2 square side by \
side, one being bigger than the other, and separate theim with small distance, snap \
will do nothing.<br>Cheers,<br>Rémi-C<br></div><div class="gmail_extra"><br><div \
class="gmail_quote"><div><div>2014-09-24 13:41 GMT+02:00 Alexandre Neto <span \
dir="ltr">&lt;<a href="mailto:senhor.neto@gmail.com" \
target="_blank">senhor.neto@gmail.com</a>&gt;</span>:<br></div></div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div><div dir="ltr">Hello all,<div><br></div><div>I have \
to tables in postgis. table one has a set of adjacent polygons that covers all my \
area o interest, while table to have a few polygons across the same \
area.</div><div><br></div><div>Some boundaries of table 2 should snap to the table 1 \
polygons, but they don&#39;t.</div><div><br></div><div>I&#39;m trying to use st_snap \
to correct this, but I&#39;m not being able to do it. There are vertices that \
&quot;refuse&quot; to change while other (just a few do). I&#39;m already using a \
very big tolerance.</div><div><br></div><div>  Therefore I need your help to see if \
my query looks correct or not.</div><div><br></div><div><br></div><div><div>WITH \
snap_grid as</div><div>(</div><div>SELECT</div><div>      St_Collect(f.geom) as \
geom</div><div>FROM</div><div>      table_1 as f</div><div>)</div><div>SELECT  \
</div><div>      r.gid, st_snap(r.geom,q.geom,10) as geom</div><div>FROM  </div><div> \
table2 as r,</div><div>      snap_grid as q</div><div>WHERE r.gid = \
53</div></div><div><br></div><div>I already tried dumping all point form the table 1 \
polygons, but the result is &quot;similar&quot;.</div><div><br></div><div>Thanks in \
advance,</div><div><br></div><div>Alexandre Neto</div></div> \
<br></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="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>
 <br>_______________________________________________<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="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>
 </div></div><br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div></div></div>




_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/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