[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] Get only the main river. Smoothline???
From: <toni () sigte ! udg ! edu>
Date: 2015-06-09 13:06:34
Message-ID: 5576E4DA.70006 () sigte ! udg ! edu
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I like the idea of removing the seg that have an "exclusive" node even
when I'm going to remove the first/last seg which are good ones.
Thanks again.
*Toni Hernández Vallčs*
Servei de Sistemes d'Informació Geogrŕfica i Teledetecció
-
Universitat de Girona
*SIGTE*
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni@sigte.udg.edu <mailto:toni@sigte.udg.edu>
http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG
On 09/06/2015 09:57, Rémi Cura wrote:
> Ok,
> let's do some tweaking then.
>
> I did something very similar, but my code is more complex that it
> should because I did it considering the fuzziness of the data
> , so I don't think it will be of much help.
>
> I tried 2 methods :
>
> Filtering using surface erosion
> - starting from a surface (called Surf)
> * generate an erosion of Surf (buffer with negative radius) called
> SurfEroded, so that you get SurfEroded close to the centerline
> * compute Straight skeleton of Surf , called SurfSS
> * Simplify SurfSS to reduce the number of node, according to the
> precision of output you expects. This is called SurfSSS
> * Dump SurfSSS into individual polylines, called SSS_seg
> * filter SSS_seg by removing all seg that have a node that is
> outside SurfEroded (and maybe that are below a given length).
> * reconstruct a line from the remaining segs.
>
> Filtering using end of segment isolation
> - starting from a surface (called Surf)
> * compute Straight skeleton of Surf , called SurfSS
> * Simplify SurfSS to reduce the number of node, according to the
> precision of output you expects. This is called SurfSSS
> * Dump SurfSSS into individual polylines, called SSS_seg
> * filter SSS_seg by removing all seg that have a node that is not
> shared by any other segments
> * reconstruct a line from the remaining segs.
>
>
> Cheers,
> Rémi-C
>
>
>
> 2015-06-09 8:56 GMT+02:00 Hugues François <hugues.francois@irstea.fr
> <mailto:hugues.francois@irstea.fr>>:
>
> Hello,
>
> I think ST_Dump could help to deal with multilinestrings:
> http://postgis.net/docs/ST_Dump.html
>
> Hugues.
>
> *De :*postgis-users-bounces@lists.osgeo.org
> <mailto:postgis-users-bounces@lists.osgeo.org>
> [mailto:postgis-users-bounces@lists.osgeo.org
> <mailto:postgis-users-bounces@lists.osgeo.org>] *De la part de*
> toni hernández
> *Envoyé :* mardi 9 juin 2015 08:09
> *Ŕ :* postgis-users@lists.osgeo.org
> <mailto:postgis-users@lists.osgeo.org>
> *Objet :* Re: [postgis-users] Get only the main river. Smoothline???
>
> Thanks Remi,
>
> I thought that but I have no starting/ending points. St_StartPoint
> and St_EndPoint are not working with MultiLinestrings
> I'll give it some more intense thought. :)
>
> Cheers.
>
> *Toni Hernández Vallčs*
> Servei de Sistemes d'Informació Geogrŕfica i Teledetecció
> -
> Universitat de Girona
> *SIGTE*
> -
> Pl. Ferrater Mora 1
> 17071 Girona
> Tel +34 972 418 039 (7026 intern)
> toni@sigte.udg.edu <mailto:toni@sigte.udg.edu>
>
> http://www.sigte.udg.edu
> Twitter http://twitter.com/SIGTE_UDG
>
> On 08/06/2015 17:45, Rémi Cura wrote:
>
> if you have start and end point of geom B,
> you can get the river path with a shortest path method (one
> liner using python, can be done in few hours using plpgsql).
>
> The idea is that you cut your geom into segments(pairs of points)
> , the length of the segment is the weight of this edge
> , and you know which segment is connected to which segment
> (adjacency graph).
>
> Then you use Networkx
> <http://networkx.lanl.gov/reference/generated/networkx.algorithms.shortest_paths.gen \
> eric.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_path>shortest
> path distance.
>
>
> Else,
>
> you are up to use some nasty workaround I suppose (playing
> with buffers on your original river surface, testing which
> segment intersects etc. ).
>
> I tried that but it ends up being more work (and more corner
> cases) than doing the things properly (in my experience).
>
> Cheers,
>
> Rémi-C
>
> 2015-06-08 16:42 GMT+02:00 toni hernández <toni@sigte.udg.edu
> <mailto:toni@sigte.udg.edu>>:
>
> Hi everyone,
>
> I have a multilinestring with a river and all its afluents as
> you can see in this image
> http://sigserver4.udg.edu/apps/geometries.png
>
> I got geometry A using St_StraithSkeleton.
>
> Is there a way to go from geometry A to geometry B??
> Maybe something similar to SmoothLine???
>
> --
> *Toni Hernández Vallčs*
> Servei de Sistemes d'Informació Geogrŕfica i Teledetecció
> -
> Universitat de Girona
> *SIGTE*
> -
> Pl. Ferrater Mora 1
> 17071 Girona
> Tel +34 972 418 039 (7026 intern)
> toni@sigte.udg.edu <mailto:toni@sigte.udg.edu>
>
> http://www.sigte.udg.edu
> Twitter http://twitter.com/SIGTE_UDG
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> <mailto:postgis-users@lists.osgeo.org>
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
>
>
> _______________________________________________
>
> postgis-users mailing list
>
> postgis-users@lists.osgeo.org <mailto:postgis-users@lists.osgeo.org>
>
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org <mailto: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)]
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I like the idea of removing the seg that have an "exclusive" node
even when I'm going to remove the first/last seg which are good
ones.<br>
<br>
Thanks again.<br>
<br>
<div class="moz-signature"><span style="font-size:8.5pt">
<b>Toni Hernández Vallčs</b>
<br>
Servei de Sistemes d'Informació Geogrŕfica i Teledetecció<br>
-<br>
Universitat de Girona<br>
<b>SIGTE</b><br>
-<br>
Pl. Ferrater Mora 1<br>
17071 Girona<br>
Tel +34 972 418 039 (7026 intern)<br>
<a href="mailto:toni@sigte.udg.edu">toni@sigte.udg.edu</a>
<br>
<br>
<a href="http://www.sigte.udg.edu">http://www.sigte.udg.edu</a><br>
Twitter <a href="http://twitter.com/SIGTE_UDG">http://twitter.com/SIGTE_UDG</a><br>
<br>
</span></div>
<div class="moz-cite-prefix">On 09/06/2015 09:57, Rémi Cura wrote:<br>
</div>
<blockquote
cite="mid:CAJvUf_u+Vp16imKCLfshK+Xz_5di_kAXk9RZbiATZY8DO7tr7Q@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default"
style="font-family:monospace,monospace">Ok,<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace">let's do some tweaking
then.<br>
<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace">I did something very
similar, but my code is more complex that it should because I
did it considering the fuzziness of the data<br>
, so I don't think it will be of much help.<br>
<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace">I tried 2 methods : <br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"><br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace">Filtering using
surface erosion<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> - starting from a
surface (called Surf)<br>
* generate an erosion of Surf (buffer with negative radius)
called SurfEroded, so that you get SurfEroded close to the
centerline<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * compute Straight
skeleton of Surf , called SurfSS<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * Simplify SurfSS to
reduce the number of node, according to the precision of
output you expects. This is called SurfSSS<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * Dump SurfSSS into
individual polylines, called SSS_seg</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * filter SSS_seg by
removing all seg that have a node that is outside SurfEroded
(and maybe that are below a given length).<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * reconstruct a line
from the remaining segs.<br>
<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace">Filtering using end of
segment isolation <br>
<div class="gmail_default"
style="font-family:monospace,monospace"> - starting from a
surface (called Surf) <br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * compute Straight
skeleton of Surf , called SurfSS<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * Simplify SurfSS
to reduce the number of node, according to the precision of
output you expects. This is called SurfSSS<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * Dump SurfSSS
into individual polylines, called SSS_seg</div>
<div class="gmail_default"
style="font-family:monospace,monospace"> * filter SSS_seg
by removing all seg that have a node that is not shared by
any other segments<br>
</div>
* reconstruct a line from the remaining segs.</div>
<div class="gmail_default"
style="font-family:monospace,monospace"><br>
<br>
Cheers,<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace">Rémi-C<br>
</div>
<div class="gmail_default"
style="font-family:monospace,monospace"><br>
<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2015-06-09 8:56 GMT+02:00 Hugues
François <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:hugues.francois@irstea.fr" \
target="_blank">hugues.francois@irstea.fr</a>></span>:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="white" link="blue" vlink="purple" lang="FR">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB">Hello,</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB">I think ST_Dump could help to deal with
multilinestrings: <a moz-do-not-send="true"
href="http://postgis.net/docs/ST_Dump.html"
\
target="_blank">http://postgis.net/docs/ST_Dump.html</a></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB">Hugues.</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"
lang="EN-GB"> </span></p>
<div>
<div style="border:none;border-top:solid #b5c4df
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">De \
:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
<a moz-do-not-send="true"
href="mailto:postgis-users-bounces@lists.osgeo.org"
target="_blank">postgis-users-bounces@lists.osgeo.org</a>
[mailto:<a moz-do-not-send="true"
href="mailto:postgis-users-bounces@lists.osgeo.org"
target="_blank">postgis-users-bounces@lists.osgeo.org</a>]
<b>De la part de</b> toni hernández<br>
<b>Envoyé :</b> mardi 9 juin 2015 08:09<br>
<b>Ŕ :</b> <a moz-do-not-send="true"
href="mailto:postgis-users@lists.osgeo.org"
target="_blank">postgis-users@lists.osgeo.org</a><br>
<b>Objet :</b> Re: [postgis-users] Get only the
main river. Smoothline???</span></p>
</div>
</div>
<div>
<div class="h5">
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-family:"Arial","sans-serif"">Thanks
Remi,<br>
<br>
I thought that but I have no starting/ending
points. St_StartPoint and St_EndPoint are not
working with MultiLinestrings<br>
I'll give it some more intense thought. :)<br>
<br>
Cheers.</span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:8.5pt">Toni Hernández
Vallčs</span></b><span
style="font-size:8.5pt"> <br>
Servei de Sistemes d'Informació Geogrŕfica i
Teledetecció<br>
-<br>
Universitat de Girona<br>
<b>SIGTE</b><br>
-<br>
Pl. Ferrater Mora 1<br>
17071 Girona<br>
Tel +34 972 418 039 (7026 intern)<br>
<a moz-do-not-send="true"
href="mailto:toni@sigte.udg.edu"
target="_blank">toni@sigte.udg.edu</a> <br>
<br>
<a moz-do-not-send="true"
href="http://www.sigte.udg.edu"
target="_blank">http://www.sigte.udg.edu</a><br>
Twitter <a moz-do-not-send="true"
href="http://twitter.com/SIGTE_UDG"
\
target="_blank">http://twitter.com/SIGTE_UDG</a></span></p> </div>
<div>
<p class="MsoNormal">On 08/06/2015 17:45, Rémi
Cura wrote:</p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><span
style="font-family:"Courier
New"">if you have start and end point
of geom B,<br>
you can get the river path with a shortest
path method (one liner using python, can
be done in few hours using plpgsql).</span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-family:"Courier
New"">The idea is that you cut your
geom into segments(pairs of points)<br>
, the length of the segment is the weight
of this edge <br>
, and you know which segment is connected
to which segment (adjacency graph).</span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-family:"Courier
New"">Then you use <a
moz-do-not-send="true"
href="http://networkx.lanl.gov/reference/generated/networkx.algorithms.shortest_paths. \
generic.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_path" \
target="_blank">Networkx </a>shortest path distance.</span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-family:"Courier
New""><br>
Else, </span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-family:"Courier
New"">you are up to use some nasty
workaround I suppose (playing with buffers
on your original river surface, testing
which segment intersects etc. ).</span></p>
</div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><span
style="font-family:"Courier
New"">I tried that but it ends up
being more work (and more corner cases)
than doing the things properly (in my
experience).</span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-family:"Courier
New"">Cheers,</span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-family:"Courier
New"">Rémi-C</span></p>
</div>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">2015-06-08 16:42
GMT+02:00 toni hernández <<a
moz-do-not-send="true"
href="mailto:toni@sigte.udg.edu"
target="_blank">toni@sigte.udg.edu</a>>:</p>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><span
\
style="font-family:"Arial","sans-serif"">Hi everyone,<br>
<br>
I have a multilinestring with a river
and all its afluents as you can see in
this image <br>
<a moz-do-not-send="true"
\
href="http://sigserver4.udg.edu/apps/geometries.png"
\
target="_blank">http://sigserver4.udg.edu/apps/geometries.png</a><br> <br>
I got geometry A using
St_StraithSkeleton.<br>
<br>
Is there a way to go from geometry A to
geometry B?? <br>
Maybe something similar to SmoothLine???<br>
<br>
</span></p>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">-- <br>
<b><span style="font-size:8.5pt">Toni
Hernández Vallčs</span></b><span
style="font-size:8.5pt"> <br>
Servei de Sistemes d'Informació
Geogrŕfica i Teledetecció<br>
-<br>
Universitat de Girona<br>
<b>SIGTE</b><br>
-<br>
Pl. Ferrater Mora 1<br>
17071 Girona<br>
Tel +34 972 418 039 (7026 intern)<br>
<a moz-do-not-send="true"
href="mailto:toni@sigte.udg.edu"
target="_blank">toni@sigte.udg.edu</a>
<br>
<br>
<a moz-do-not-send="true"
href="http://www.sigte.udg.edu"
target="_blank">http://www.sigte.udg.edu</a><br>
Twitter <a moz-do-not-send="true"
href="http://twitter.com/SIGTE_UDG"
\
target="_blank">http://twitter.com/SIGTE_UDG</a></span></p> </div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:postgis-users@lists.osgeo.org"
target="_blank">postgis-users@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
\
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users"
\
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></p> \
</div> <p class="MsoNormal"> </p>
</div>
<p class="MsoNormal"><br>
<br>
<br>
</p>
<pre>_______________________________________________</pre>
<pre>postgis-users mailing list</pre>
<pre><a moz-do-not-send="true" \
href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a></pre> <pre><a \
moz-do-not-send="true" \
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></pre>
</blockquote>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
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>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a> <a \
class="moz-txt-link-freetext" \
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></pre>
</blockquote>
<br>
</body>
</html>
_______________________________________________
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