Re: [postgis-users] Get only the main river. Smoothline???
Remi, I didn't tell you before but I want to use the main river line as the line for labeling river's name. So an approximation to the main river is good enough for me. For a major number of cases (rivers tend to be quite linear), I can use the st_longestline to get an approximation for the start/end points and from there I can use the routing functions. Thanks. 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) t...@sigte.udg.edu mailto:t...@sigte.udg.edu http://www.sigte.udg.edu Twitter http://twitter.com/SIGTE_UDG On 09/06/2015 08:09, toni hernández wrote: 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) t...@sigte.udg.edu mailto:t...@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.generic.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_pathshortest 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 t...@sigte.udg.edu mailto:t...@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) t...@sigte.udg.edu mailto:t...@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 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
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) t...@sigte.udg.edu mailto:t...@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.generic.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_pathshortest 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 t...@sigte.udg.edu mailto:t...@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) t...@sigte.udg.edu mailto:t...@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 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
Re: [postgis-users] Get only the main river. Smoothline???
thanks Hugues, The thing is that with st_Dump I get all the linestrings of a river but there is no way (that I know of) that I can order all the segments and get the real start /end points of the whole river. *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) t...@sigte.udg.edu mailto:t...@sigte.udg.edu http://www.sigte.udg.edu Twitter http://twitter.com/SIGTE_UDG On 09/06/2015 08:56, Hugues François wrote: Hello, I think ST_Dump could help to deal with multilinestrings: http://postgis.net/docs/ST_Dump.html Hugues. *De :*postgis-users-boun...@lists.osgeo.org [mailto:postgis-users-boun...@lists.osgeo.org] *De la part de* toni hernández *Envoyé :* mardi 9 juin 2015 08:09 *À :* 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) t...@sigte.udg.edu mailto:t...@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.generic.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_pathshortest 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 t...@sigte.udg.edu mailto:t...@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) t...@sigte.udg.edu mailto:t...@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 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
Re: [postgis-users] Get only the main river. Smoothline???
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) t...@sigte.udg.edu mailto:t...@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.franc...@irstea.fr mailto:hugues.franc...@irstea.fr: Hello, I think ST_Dump could help to deal with multilinestrings: http://postgis.net/docs/ST_Dump.html Hugues. *De :*postgis-users-boun...@lists.osgeo.org mailto:postgis-users-boun...@lists.osgeo.org [mailto:postgis-users-boun...@lists.osgeo.org mailto:postgis-users-boun...@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) t...@sigte.udg.edu mailto:t...@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.generic.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_pathshortest 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 t...@sigte.udg.edu mailto:t...@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) t...@sigte.udg.edu mailto:t...@sigte.udg.edu http://www.sigte.udg.edu Twitter http://twitter.com/SIGTE_UDG
[postgis-users] Get only the main river. Smoothline???
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) t...@sigte.udg.edu mailto:t...@sigte.udg.edu http://www.sigte.udg.edu Twitter http://twitter.com/SIGTE_UDG ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Get only the main river. Smoothline???
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.generic.shortest_path.html#networkx.algorithms.shortest_paths.generic.shortest_pathshortest 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 t...@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) t...@sigte.udg.edu http://www.sigte.udg.edu Twitter http://twitter.com/SIGTE_UDG ___ 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