Re: [GRASS-user] snap point to line/break line at given points
On 25/04/11 18:37, Johannes Radinger wrote: Am 25.04.2011 um 15:51 schrieb Moritz Lennert: On 25/04/11 12:04, Micha Silver wrote: On 04/24/2011 03:36 PM, Johannes Radinger wrote: Hi Micha, Hi other GRASS users! Am 23.04.2011 um 18:01 schrieb Micha Silver: So if I understand you correctly, it is not really possible to split a river network at one point into to parts. I attached a picture to illustrate what I want (e.g. two break points in a rivernet). I think that this kind of breaking I want to do is quite common, so there's probably another solution in grass gis... Well, in QGIS you can merge all the line segments of the original shapefile into one, using the "Vector->Geometry Tools->Singleparts to Multipart" tool. This will leave you with a single "MULTILINE" feature. However when importing to GRASS all the lines will be "re-broken" at each intersection and new nodes created in order to enforce topology. Referring to the attached image (I altered yours) the stars represent topological "errors" and as far as I know GRASS will not allow you to ignore these intersections when you import. (The only vector feature that can be imported without topology is points). So to recap: * You can split line features at arbitrary points using v.edit tool=break * You cannot, AFAIK, cause GRASS to merge line segments where topological rules require there to be a node. You can, however, attribute the same category number (or the same other arbitrary attribute) to those segments which belong to the same subnetwork. For sure that would be a solution to have the same category number for all single segments in a subnetwork. But how to define the subnetwork between the breakpoints, or how can I tell grass which segments belong to a subnetwork, so far I don't know any tool in GRASS which I can use in a python script. GRASS cannot guess which segment belongs to which subnet. This is an information that you have to provide GRASS with in some form. Maybe v.strahler in the GRASS AddOns can help you. Or you can use r.watershed to create basins and then attribute the basin numbers to your vector lines ? Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
Am 25.04.2011 um 15:51 schrieb Moritz Lennert: On 25/04/11 12:04, Micha Silver wrote: On 04/24/2011 03:36 PM, Johannes Radinger wrote: Hi Micha, Hi other GRASS users! Am 23.04.2011 um 18:01 schrieb Micha Silver: So if I understand you correctly, it is not really possible to split a river network at one point into to parts. I attached a picture to illustrate what I want (e.g. two break points in a rivernet). I think that this kind of breaking I want to do is quite common, so there's probably another solution in grass gis... Well, in QGIS you can merge all the line segments of the original shapefile into one, using the "Vector->Geometry Tools->Singleparts to Multipart" tool. This will leave you with a single "MULTILINE" feature. However when importing to GRASS all the lines will be "re-broken" at each intersection and new nodes created in order to enforce topology. Referring to the attached image (I altered yours) the stars represent topological "errors" and as far as I know GRASS will not allow you to ignore these intersections when you import. (The only vector feature that can be imported without topology is points). So to recap: * You can split line features at arbitrary points using v.edit tool=break * You cannot, AFAIK, cause GRASS to merge line segments where topological rules require there to be a node. You can, however, attribute the same category number (or the same other arbitrary attribute) to those segments which belong to the same subnetwork. For sure that would be a solution to have the same category number for all single segments in a subnetwork. But how to define the subnetwork between the breakpoints, or how can I tell grass which segments belong to a subnetwork, so far I don't know any tool in GRASS which I can use in a python script. Your "physical" (i.e. on disk in GRASS format) representation of the network(s) does not necessarily have to be the same as the semantical (content-oriented) representation. So you can represent the subnetworks through attribute info. Or you can play with layers: the entire river network with the same cat value in layer 1, different cat values for subnetworks in layer 2. Either with layers or with additonal attributes both can be solutions but the problem is still the "how", the problem to define this subnetworks (see picture in former posts) /johannes If you need to extract only parts of the network, almost all of the modules allow you to either use cat values or a where clause on your attribute as a filter. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
Am 25.04.2011 um 15:51 schrieb Moritz Lennert: On 25/04/11 12:04, Micha Silver wrote: On 04/24/2011 03:36 PM, Johannes Radinger wrote: Hi Micha, Hi other GRASS users! Am 23.04.2011 um 18:01 schrieb Micha Silver: So if I understand you correctly, it is not really possible to split a river network at one point into to parts. I attached a picture to illustrate what I want (e.g. two break points in a rivernet). I think that this kind of breaking I want to do is quite common, so there's probably another solution in grass gis... Well, in QGIS you can merge all the line segments of the original shapefile into one, using the "Vector->Geometry Tools->Singleparts to Multipart" tool. This will leave you with a single "MULTILINE" feature. However when importing to GRASS all the lines will be "re-broken" at each intersection and new nodes created in order to enforce topology. Referring to the attached image (I altered yours) the stars represent topological "errors" and as far as I know GRASS will not allow you to ignore these intersections when you import. (The only vector feature that can be imported without topology is points). So to recap: * You can split line features at arbitrary points using v.edit tool=break * You cannot, AFAIK, cause GRASS to merge line segments where topological rules require there to be a node. You can, however, attribute the same category number (or the same other arbitrary attribute) to those segments which belong to the same subnetwork. For sure that would be a solution to have the same category number for all single segments in a subnetwork. But how to define the subnetwork between the breakpoints, or how can I tell grass which segments belong to a subnetwork, so far I don't know any tool in GRASS which I can use in a python script. Your "physical" (i.e. on disk in GRASS format) representation of the network(s) does not necessarily have to be the same as the semantical (content-oriented) representation. So you can represent the subnetworks through attribute info. Or you can play with layers: the entire river network with the same cat value in layer 1, different cat values for subnetworks in layer 2. Either with layers or with additonal attributes both can be solutions but the problem is still the "how", the problem to define this subnetworks (see picture in former posts) /johannes If you need to extract only parts of the network, almost all of the modules allow you to either use cat values or a where clause on your attribute as a filter. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 25/04/11 12:04, Micha Silver wrote: On 04/24/2011 03:36 PM, Johannes Radinger wrote: Hi Micha, Hi other GRASS users! Am 23.04.2011 um 18:01 schrieb Micha Silver: So if I understand you correctly, it is not really possible to split a river network at one point into to parts. I attached a picture to illustrate what I want (e.g. two break points in a rivernet). I think that this kind of breaking I want to do is quite common, so there's probably another solution in grass gis... Well, in QGIS you can merge all the line segments of the original shapefile into one, using the "Vector->Geometry Tools->Singleparts to Multipart" tool. This will leave you with a single "MULTILINE" feature. However when importing to GRASS all the lines will be "re-broken" at each intersection and new nodes created in order to enforce topology. Referring to the attached image (I altered yours) the stars represent topological "errors" and as far as I know GRASS will not allow you to ignore these intersections when you import. (The only vector feature that can be imported without topology is points). So to recap: * You can split line features at arbitrary points using v.edit tool=break * You cannot, AFAIK, cause GRASS to merge line segments where topological rules require there to be a node. You can, however, attribute the same category number (or the same other arbitrary attribute) to those segments which belong to the same subnetwork. Your "physical" (i.e. on disk in GRASS format) representation of the network(s) does not necessarily have to be the same as the semantical (content-oriented) representation. So you can represent the subnetworks through attribute info. Or you can play with layers: the entire river network with the same cat value in layer 1, different cat values for subnetworks in layer 2. If you need to extract only parts of the network, almost all of the modules allow you to either use cat values or a where clause on your attribute as a filter. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 04/24/2011 03:36 PM, Johannes Radinger wrote: Hi Micha, Hi other GRASS users! Am 23.04.2011 um 18:01 schrieb Micha Silver: So if I understand you correctly, it is not really possible to split a river network at one point into to parts. I attached a picture to illustrate what I want (e.g. two break points in a rivernet). I think that this kind of breaking I want to do is quite common, so there's probably another solution in grass gis... Well, in QGIS you can merge all the line segments of the original shapefile into one, using the "Vector->Geometry Tools->Singleparts to Multipart" tool. This will leave you with a single "MULTILINE" feature. However when importing to GRASS all the lines will be "re-broken" at each intersection and new nodes created in order to enforce topology. Referring to the attached image (I altered yours) the stars represent topological "errors" and as far as I know GRASS will not allow you to ignore these intersections when you import. (The only vector feature that can be imported without topology is points). So to recap: * You can split line features at arbitrary points using v.edit tool=break * You cannot, AFAIK, cause GRASS to merge line segments where topological rules require there to be a node. Back to your problem, If you're into PostGIS, here's a post that might give you some ideas: http://postgis.refractions.net/pipermail/postgis-users/2007-September/017159.html Regards, Micha I appreciate any hints to solve that (just see the attached picture and the older posts) thanks /johannes Regards, Micha In the end I want two features/categories one on each side of the break. what are the exact steps especially when I want to do it with several points (I know the procedure with a python for loop in combination with v.edit). This mail was received via Mail-SeCure System. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. -- Micha Silver Arava Development Co. +972-52-3665918 http://www.surfaces.co.il ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. -- Micha Silver Arava Development Co. +972-52-3665918 http://www.surfaces.co.il <>___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
Hi Micha,Hi other GRASS users!Am 23.04.2011 um 18:01 schrieb Micha Silver: Hi Johannes: On 04/22/2011 05:15 PM, Johannes Radinger wrote: Am 22.04.2011 um 13:22 schrieb Moritz Lennert: On 22/04/11 11:34, Johannes Radinger wrote: About my situation: I've got a river network, which is a polylinefeature set with 43 lines (43 IDs) included (tree-like shape of a rivernet) all with the same cat-value (1). Now I would like to unite/merge the lines to one feature (1 ID) if that is possible and break that single element at given points with v.edit...Because if I break now at around 40 positions I get over 80 segements (40 old segements and which are broken again at different positions) but there should be only 41 or so... so how can I handle that and assign unique cat values for each segment...(at the moment the don't have to be the same like the breakpoints, just unique values) any suggestions? v.edit tool=catadd id= ? Sorry but I am still confused how to do the break. In the Attachment there is a GRASS-exported shp.-file with my rivernet consisting of 43 single lines. I want to break that river at e.g. 3521021.43671,6041340.79067 which is one point (out of others) along the river. Here's what I tried: GRASS 6.4.0 (WGS84):~/geodata > v.edit river_gen tool=break coords="3521021.43671,6041340.79067" Selecting features... 100% 1 of 43 features selected from vector map 100% 1 lines broken Building topology for vector map ... Registering primitives... 44 primitives registered 17135 vertices registered Building areas... 100% 0 areas built 0 isles built Attaching islands... Attaching centroids... 100% Number of nodes: 45 Number of primitives: 44 Number of points: 0 Number of lines: 44 Number of boundaries: 0 Number of centroids: 0 Number of areas: 0 Number of isles: 0 v.edit complete. So I there are now 44 line segments as opposed to the original 43. One got split into two. But the two new segments have the same cat number. Next I wiped out all the old cats: GRASS 6.4.0 (WGS84):~/geodata > v.category river_gen opt=del cat=1-43 out=river_gen_tmp and recreated new cats into a new vector: GRASS 6.4.0 (WGS84):~/geodata > v.category --o river_gen_tmp opt=add out=river_gen_2 In the attached image you can see that the original line segment with cat=12 (black numbers) got split into two (after the v.edit step). THe red numbers are the new cat values, and that line segment got cats 43 and 44. Reviewing your first post I want to also note: I believe that GRASS's topology model will not allow you to merge the original river segments into one "polyline" (MULTILINE in other GIS). You *can* of course have polylines in GRASS, but they must consist of two line segments connected at exactly one point. In any typical river network you always have three segments intersecting: the upstream reach, the tributary and the downstream reach. Others with more experience may correct me, but I think that if you must merge all the river segments into one "MULTILINE" before splitting at the new points, then you'll have to use some other tool and non-topological vector data format outside of GRASS. So if I understand you correctly, it is not really possible to split a river network at one point into to parts. I attached a picture to illustrate what I want (e.g. two break points in a rivernet). I think that this kind of breaking I want to do is quite common, so there's probably another solution in grass gis...I appreciate any hints to solve that (just see the attached picture and the older posts)thanks/johannes Regards, Micha In the end I want two features/categories one on each side of the break. what are the exact steps especially when I want to do it with several points (I know the procedure with a python for loop in combination with v.edit). This mail was received via Mail-SeCure System. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. -- Micha Silver Arava Development Co. +972-52-3665918 http://www.surfaces.co.il ___grass-user mailing listgrass-user@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/grass-user___ grass-user mailing list grass-user@lists.
Re: [GRASS-user] snap point to line/break line at given points
Hi Johannes: On 04/22/2011 05:15 PM, Johannes Radinger wrote: Am 22.04.2011 um 13:22 schrieb Moritz Lennert: On 22/04/11 11:34, Johannes Radinger wrote: About my situation: I've got a river network, which is a polylinefeature set with 43 lines (43 IDs) included (tree-like shape of a rivernet) all with the same cat-value (1). Now I would like to unite/merge the lines to one feature (1 ID) if that is possible and break that single element at given points with v.edit...Because if I break now at around 40 positions I get over 80 segements (40 old segements and which are broken again at different positions) but there should be only 41 or so... so how can I handle that and assign unique cat values for each segment...(at the moment the don't have to be the same like the breakpoints, just unique values) any suggestions? v.edit tool=catadd id= ? Sorry but I am still confused how to do the break. In the Attachment there is a GRASS-exported shp.-file with my rivernet consisting of 43 single lines. I want to break that river at e.g. 3521021.43671,6041340.79067 which is one point (out of others) along the river. Here's what I tried: GRASS 6.4.0 (WGS84):~/geodata > v.edit river_gen tool=break coords="3521021.43671,6041340.79067" Selecting features... 100% 1 of 43 features selected from vector map 100% 1 lines broken Building topology for vector map ... Registering primitives... 44 primitives registered 17135 vertices registered Building areas... 100% 0 areas built 0 isles built Attaching islands... Attaching centroids... 100% Number of nodes: 45 Number of primitives: 44 Number of points: 0 Number of lines: 44 Number of boundaries: 0 Number of centroids: 0 Number of areas: 0 Number of isles: 0 v.edit complete. So I there are now 44 line segments as opposed to the original 43. One got split into two. But the two new segments have the same cat number. Next I wiped out all the old cats: GRASS 6.4.0 (WGS84):~/geodata > v.category river_gen opt=del cat=1-43 out=river_gen_tmp and recreated new cats into a new vector: GRASS 6.4.0 (WGS84):~/geodata > v.category --o river_gen_tmp opt=add out=river_gen_2 In the attached image you can see that the original line segment with cat=12 (black numbers) got split into two (after the v.edit step). THe red numbers are the new cat values, and that line segment got cats 43 and 44. Reviewing your first post I want to also note: I believe that GRASS's topology model will not allow you to merge the original river segments into one "polyline" (MULTILINE in other GIS). You *can* of course have polylines in GRASS, but they must consist of two line segments connected at exactly one point. In any typical river network you always have three segments intersecting: the upstream reach, the tributary and the downstream reach. Others with more experience may correct me, but I think that if you must merge all the river segments into one "MULTILINE" before splitting at the new points, then you'll have to use some other tool and non-topological vector data format outside of GRASS. Regards, Micha In the end I want two features/categories one on each side of the break. what are the exact steps especially when I want to do it with several points (I know the procedure with a python for loop in combination with v.edit). This mail was received via Mail-SeCure System. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. -- Micha Silver Arava Development Co. +972-52-3665918 http://www.surfaces.co.il <>___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 22/04/11 11:34, Johannes Radinger wrote: About my situation: I've got a river network, which is a polylinefeature set with 43 lines (43 IDs) included (tree-like shape of a rivernet) all with the same cat-value (1). Now I would like to unite/merge the lines to one feature (1 ID) if that is possible and break that single element at given points with v.edit...Because if I break now at around 40 positions I get over 80 segements (40 old segements and which are broken again at different positions) but there should be only 41 or so... so how can I handle that and assign unique cat values for each segment...(at the moment the don't have to be the same like the breakpoints, just unique values) any suggestions? v.edit tool=catadd id= ? Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
Am 18.04.2011 um 13:40 schrieb Micha Silver: > On 04/18/2011 01:55 PM, Micha Silver wrote: >> >> >> Maybe a few more details might be helpful: >> If you want to first get the coordinates of the new points along the >> (simplified) river line, >> (starting with a line vector 'river' and a set of points 'old_pts' displaced >> from the line) you first do: >> >> ~>v.db.addtable old_pts col="x double precision, y double precision" >> >> then: >> >> ~>v.distance --o to=river from=old_pts out=connectors upload=to_x,to_y >> col=x,y >> >> This puts the *new* X-Y coordinates of points exactly on the river, and at >> the node of perpendicular 'connectors' from the old points to the river into >> the old_pts attribute table. >> Now: >> >> ~>v.db.select -c old_pts col=x,y >new_pts.txt >> ~>v.db.select -c old_pts fs=, col=x,y | v.in.ascii out=new_pts >> >> THis gives you both a new point vector of the points along the river, and a >> text file of their coordinates. Next, I used Moritz's method to split the >> river at these new points, in a loop like: >> >> ~>while read coord; do v.edit river tool=break coord=$coord; done < >> new_pts.txt >> >> This leaves you with a multi-segment line vector, split at the new points. >> >> >>> v.net option=connect + some cleaning afterwards might be another possible >>> solution. For each point, it will create a line connecting it to the river, >>> breaking the river at the intersection. >>> >>> v.distance should be able to do the labelling for you. >>> >> >> I tried this part, but couldn't get it to work :-( . > >> >> So I don't know what to suggest to get the cat values from the new points >> into the river segments... >> > > > Update: > I have found a kind of work around to get the same cat values in both the > points and river segments, although it's a bit "backwards". THe modules > v.distance and v.what.vect can only connect from a point vector to another > line or area vector. Then values from the "to" (line or area) can be uploaded > to the points. So if I reset the categories in the river line vector - so > that each segment has it;s own cat, then I can upload those cat values into > the new points vector. Here's the procedure: > > FIrst blow away the existing categories in the river vector and recreate a > new vector with new category values: > > ~>v.category river opt=del out=river2 --o > ~ > v.db.droptable -f river2 > ~ > v.db.addtable river2 > ~ > v.category river2 out=river3 --o > > Now river3 should contain a new cat value, one for each line segment. Check > with: > > ~ > v.category river3 opt=print > 1 > 2 > 3 > . Somehow that isnt' working in my case. About my situation: I've got a river network, which is a polylinefeature set with 43 lines (43 IDs) included (tree-like shape of a rivernet) all with the same cat-value (1). Now I would like to unite/merge the lines to one feature (1 ID) if that is possible and break that single element at given points with v.edit...Because if I break now at around 40 positions I get over 80 segements (40 old segements and which are broken again at different positions) but there should be only 41 or so... so how can I handle that and assign unique cat values for each segment...(at the moment the don't have to be the same like the breakpoints, just unique values) any suggestions? /johannes > > And finally: > ~ > v.db.addcol new_pts col="river_cat integer" > ~ > v.what.vect vect=new_pts col=river_cat qvect=river3 qcol=cat dmax=0.01 > > creates a new column in the new_pts vector attrib table called 'river_cats' > with values matching the adjacent river segment. > > Regards, > Micha > >> Regards, >> Micha >> > > ___ > grass-user mailing list > grass-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 18/04/11 12:55, Micha Silver wrote: On 04/18/2011 12:55 PM, Moritz Lennert wrote: v.distance should be able to do the labelling for you. I tried this part, but couldn't get it to work :-( . I used v.what.vect (and v.distance directly) to get the cat values from the new points into the river vector line segments, but each time it gave me: ~ > v.distance from=river to=new_pts upload=cat col=pt_cat to_col=cat 100% 100% 1 categories exist in the table 0 records updated v.distance complete. But the new_pts vector has 6 cats: ~ > v.category new_pts opt=print 1 2 3 4 5 6 and the river vector has 7 segments: Yes, but how many cat values. probably all segments have the same cat value. You might have to use v.category to create separate cat values for each line. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 04/18/2011 01:55 PM, Micha Silver wrote: Maybe a few more details might be helpful: If you want to first get the coordinates of the new points along the (simplified) river line, (starting with a line vector 'river' and a set of points 'old_pts' displaced from the line) you first do: ~>v.db.addtable old_pts col="x double precision, y double precision" then: ~>v.distance --o to=river from=old_pts out=connectors upload=to_x,to_y col=x,y This puts the *new* X-Y coordinates of points exactly on the river, and at the node of perpendicular 'connectors' from the old points to the river into the old_pts attribute table. Now: ~>v.db.select -c old_pts col=x,y >new_pts.txt ~>v.db.select -c old_pts fs=, col=x,y | v.in.ascii out=new_pts THis gives you both a new point vector of the points along the river, and a text file of their coordinates. Next, I used Moritz's method to split the river at these new points, in a loop like: ~>while read coord; do v.edit river tool=break coord=$coord; done < new_pts.txt This leaves you with a multi-segment line vector, split at the new points. v.net option=connect + some cleaning afterwards might be another possible solution. For each point, it will create a line connecting it to the river, breaking the river at the intersection. v.distance should be able to do the labelling for you. I tried this part, but couldn't get it to work :-( . So I don't know what to suggest to get the cat values from the new points into the river segments... Update: I have found a kind of work around to get the same cat values in both the points and river segments, although it's a bit "backwards". THe modules v.distance and v.what.vect can only connect from a point vector to another line or area vector. Then values from the "to" (line or area) can be uploaded to the points. So if I reset the categories in the river line vector - so that each segment has it;s own cat, then I can upload those cat values into the new points vector. Here's the procedure: FIrst blow away the existing categories in the river vector and recreate a new vector with new category values: ~>v.category river opt=del out=river2 --o ~ > v.db.droptable -f river2 ~ > v.db.addtable river2 ~ > v.category river2 out=river3 --o Now river3 should contain a new cat value, one for each line segment. Check with: ~ > v.category river3 opt=print 1 2 3 . And finally: ~ > v.db.addcol new_pts col="river_cat integer" ~ > v.what.vect vect=new_pts col=river_cat qvect=river3 qcol=cat dmax=0.01 creates a new column in the new_pts vector attrib table called 'river_cats' with values matching the adjacent river segment. Regards, Micha Regards, Micha ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 04/18/2011 12:55 PM, Moritz Lennert wrote: On 18/04/11 08:19, Johannes Radinger wrote: Am 16.04.2011 um 17:25 schrieb Daniel Victoria: Not sure how to split and label the rivers but to snap the point to the closest river you could use v.distance I also thought about v.distance. There I get the coordinates of the closest points on the new line (stdout). I just have to create a new pointfile from the standard output coordinates...or is there any simpler way? > And I also still don't know how to split the lines at these points. I thought about v.split but here are segemnts created at equidistant breakpoints and one can only set the distance in metres but it is not possible to use coordinates as input...anyone knows how to do that? v.edit tool=break coords=CoordinatesOfYourPoints Maybe a few more details might be helpful: If you want to first get the coordinates of the new points along the (simplified) river line, (starting with a line vector 'river' and a set of points 'old_pts' displaced from the line) you first do: ~>v.db.addtable old_pts col="x double precision, y double precision" then: ~>v.distance --o to=river from=old_pts out=connectors upload=to_x,to_y col=x,y This puts the *new* X-Y coordinates of points exactly on the river, and at the node of perpendicular 'connectors' from the old points to the river into the old_pts attribute table. Now: ~>v.db.select -c old_pts col=x,y >new_pts.txt ~>v.db.select -c old_pts fs=, col=x,y | v.in.ascii out=new_pts THis gives you both a new point vector of the points along the river, and a text file of their coordinates. Next, I used Moritz's method to split the river at these new points, in a loop like: ~>while read coord; do v.edit river tool=break coord=$coord; done < new_pts.txt This leaves you with a multi-segment line vector, split at the new points. v.net option=connect + some cleaning afterwards might be another possible solution. For each point, it will create a line connecting it to the river, breaking the river at the intersection. v.distance should be able to do the labelling for you. I tried this part, but couldn't get it to work :-( . I used v.what.vect (and v.distance directly) to get the cat values from the new points into the river vector line segments, but each time it gave me: ~ > v.distance from=river to=new_pts upload=cat col=pt_cat to_col=cat 100% 100% 1 categories exist in the table 0 records updated v.distance complete. But the new_pts vector has 6 cats: ~ > v.category new_pts opt=print 1 2 3 4 5 6 and the river vector has 7 segments: GRASS 6.4.0 (WGS84):~ > v.info -t river nodes=8 points=0 lines=7 boundaries=0 centroids=0 areas=0 islands=0 faces=0 kernels=0 primitives=7 map3d=0 So I don't know what to suggest to get the cat values from the new points into the river segments... Regards, Micha Moritz cheers /johannes Cheers daniel http://grass.fbk.eu/grass65/manuals/html65_user/v.distance.html On Thu, Apr 14, 2011 at 6:36 AM, Johannes Radinger wrote: Hello, I have a line-vector (river) and some points on that line. First I am straightening that line with v.generalize (method: boyle). Now, there is the problem that the points are not exactly on the line anymore. So I want to snap (move) the points to the new generalized line again. Which tool is able to do that? After that I want to split the line at these points and want to give the attribute value to the newly created segments. These segment values should represent the number/value of the upstream point (which was used to split). How can this be done in GRASS? Do you have any ideas to solve these two problems/challenges? thank you /johannes -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. -- Micha Silver Arava Development Co. +972-52-3665918 http://www.surfaces.co.il ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
On 18/04/11 08:19, Johannes Radinger wrote: Am 16.04.2011 um 17:25 schrieb Daniel Victoria: Not sure how to split and label the rivers but to snap the point to the closest river you could use v.distance I also thought about v.distance. There I get the coordinates of the closest points on the new line (stdout). I just have to create a new pointfile from the standard output coordinates...or is there any simpler way? > And I also still don't know how to split the lines at these points. I thought about v.split but here are segemnts created at equidistant breakpoints and one can only set the distance in metres but it is not possible to use coordinates as input...anyone knows how to do that? v.edit tool=break coords=CoordinatesOfYourPoints v.net option=connect + some cleaning afterwards might be another possible solution. For each point, it will create a line connecting it to the river, breaking the river at the intersection. v.distance should be able to do the labelling for you. Moritz cheers /johannes Cheers daniel http://grass.fbk.eu/grass65/manuals/html65_user/v.distance.html On Thu, Apr 14, 2011 at 6:36 AM, Johannes Radinger wrote: Hello, I have a line-vector (river) and some points on that line. First I am straightening that line with v.generalize (method: boyle). Now, there is the problem that the points are not exactly on the line anymore. So I want to snap (move) the points to the new generalized line again. Which tool is able to do that? After that I want to split the line at these points and want to give the attribute value to the newly created segments. These segment values should represent the number/value of the upstream point (which was used to split). How can this be done in GRASS? Do you have any ideas to solve these two problems/challenges? thank you /johannes -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
Am 16.04.2011 um 17:25 schrieb Daniel Victoria: Not sure how to split and label the rivers but to snap the point to the closest river you could use v.distance I also thought about v.distance. There I get the coordinates of the closest points on the new line (stdout). I just have to create a new pointfile from the standard output coordinates...or is there any simpler way? And I also still don't know how to split the lines at these points. I thought about v.split but here are segemnts created at equidistant breakpoints and one can only set the distance in metres but it is not possible to use coordinates as input...anyone knows how to do that? cheers /johannes Cheers daniel http://grass.fbk.eu/grass65/manuals/html65_user/v.distance.html On Thu, Apr 14, 2011 at 6:36 AM, Johannes Radinger wrote: Hello, I have a line-vector (river) and some points on that line. First I am straightening that line with v.generalize (method: boyle). Now, there is the problem that the points are not exactly on the line anymore. So I want to snap (move) the points to the new generalized line again. Which tool is able to do that? After that I want to split the line at these points and want to give the attribute value to the newly created segments. These segment values should represent the number/value of the upstream point (which was used to split). How can this be done in GRASS? Do you have any ideas to solve these two problems/challenges? thank you /johannes -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] snap point to line/break line at given points
Not sure how to split and label the rivers but to snap the point to the closest river you could use v.distance Cheers daniel http://grass.fbk.eu/grass65/manuals/html65_user/v.distance.html On Thu, Apr 14, 2011 at 6:36 AM, Johannes Radinger wrote: > Hello, > > I have a line-vector (river) and some points on that line. First I am > straightening that line with v.generalize (method: boyle). Now, there is the > problem that the points are not exactly on the line anymore. So I want to > snap (move) the points to the new generalized line again. Which tool is able > to do that? > > After that I want to split the line at these points and want to give the > attribute value to the newly created segments. These segment values should > represent the number/value of the upstream point (which was used to split). > How can this be done in GRASS? > > Do you have any ideas to solve these two problems/challenges? > > thank you > > /johannes > -- > GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit > gratis Handy-Flat! http://portal.gmx.net/de/go/dsl > ___ > grass-user mailing list > grass-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/grass-user > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user