Hi all.
A couple of issues I ran into today:
- I have a layer with some good and some bad polygons; how do I import it into GRASS
letting the bad ones snapping onto the good ones, and not vice versa?
- I want to change the contour lines into closed polygons (namely, for contour lines;
I tried v.type.lb, to add centroid afterwards, but it does not seem to produce valid
polygons.
Any hint?
Thanks a lot.
--
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
On Mon, Jan 23, 2012 at 8:00 PM, Paolo Cavallini <cavallini@faunalia.it> wrote:
Hi all.
A couple of issues I ran into today:
- I have a layer with some good and some bad polygons; how do I import it into GRASS
letting the bad ones snapping onto the good ones, and not vice versa?
You could try v.edit, otherwise it will be hand-editing with a digitizer.
With topological vectors, snapping one set of polygons to another set
of polygons does not make sense, because there are no polygons in
topological vectors, only shared boundaries. That is probably the
reason why this functionality is not available in grass.
- I want to change the contour lines into closed polygons (namely, for contour lines;
I tried v.type.lb, to add centroid afterwards, but it does not seem to produce valid
polygons.
Any hint?
For contour lines, you would need to patch the vector with contour
lines with a vector created with v.in.region type=line, then break
lines at intersections, convert lines to boundaries, add centroids.
This assumes that not closed contour lines have endpoints exactly at
the extents of the vector, e.g. if the western edge of the contour
vector is 30 and there is an open contour line ending at say
29.99999999, this will not work. If the contour lines were produced
with r.contour, this should work.
HTH,
Markus M
Il 26/01/2012 20:41, Markus Metz ha scritto:
On Mon, Jan 23, 2012 at 8:00 PM, Paolo Cavallini <cavallini@faunalia.it> wrote:
Hi all.
A couple of issues I ran into today:
- I have a layer with some good and some bad polygons; how do I import it into GRASS
letting the bad ones snapping onto the good ones, and not vice versa?You could try v.edit, otherwise it will be hand-editing with a digitizer.
With topological vectors, snapping one set of polygons to another set
of polygons does not make sense, because there are no polygons in
topological vectors, only shared boundaries. That is probably the
reason why this functionality is not available in grass.
Hi Markus M,
thanks for your reply. Let me explain better my use case:
- I have a shapefile, with (almost) adjacent polygons
- if I import them, I can snap the almost adjacent lines, and get common boundaries
- the problem is that I cannot control which of the two adjacent lines stay fixed,
and which one moves to it
- I know that of the two polygons, one is good (certified), the other is not; so I
want the first to remain fixed, and have the other snap to it.
Did I explain myself better?
For contour lines, you would need to patch the vector with contour
lines with a vector created with v.in.region type=line, then break
lines at intersections, convert lines to boundaries, add centroids.
This assumes that not closed contour lines have endpoints exactly at
the extents of the vector, e.g. if the western edge of the contour
vector is 30 and there is an open contour line ending at say
29.99999999, this will not work. If the contour lines were produced
with r.contour, this should work.
In practice:
#set the region around contour
v.in.region output=region_line type=line
v.patch input=contour,region_line output=patched
v.clean input=patched@paolo type=line tool=snap thresh=1 output=patched_1
v.clean input=patched@paolo type=line tool=break output=patched_break
v.type input=patched_break@paolo output=patched_break_boundaries type=line,boundary
v.centroids input=patched_break_boundaries output=polygons
It mostly works, but apparently breaking does not (only closed rings become different
polygons).
In the meantime, I spotted a few minor issues in the qgis-grass interface, I'm going
to fix them.
Thanks a lot.
--
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
On Fri, Jan 27, 2012 at 1:02 PM, Paolo Cavallini <cavallini@faunalia.it> wrote:
Il 26/01/2012 20:41, Markus Metz ha scritto:
On Mon, Jan 23, 2012 at 8:00 PM, Paolo Cavallini <cavallini@faunalia.it> wrote:
Hi all.
A couple of issues I ran into today:
- I have a layer with some good and some bad polygons; how do I import it into GRASS
letting the bad ones snapping onto the good ones, and not vice versa?You could try v.edit, otherwise it will be hand-editing with a digitizer.
With topological vectors, snapping one set of polygons to another set
of polygons does not make sense, because there are no polygons in
topological vectors, only shared boundaries. That is probably the
reason why this functionality is not available in grass.Hi Markus M,
thanks for your reply. Let me explain better my use case:
- I have a shapefile, with (almost) adjacent polygons
- if I import them, I can snap the almost adjacent lines, and get common boundaries
- the problem is that I cannot control which of the two adjacent lines stay fixed,
and which one moves to it
- I know that of the two polygons, one is good (certified), the other is not; so I
want the first to remain fixed, and have the other snap to it.
Did I explain myself better?
The only two options I can think of is giving v.edit a try, otherwise
hand-editing.
For contour lines, you would need to patch the vector with contour
lines with a vector created with v.in.region type=line, then break
lines at intersections, convert lines to boundaries, add centroids.
This assumes that not closed contour lines have endpoints exactly at
the extents of the vector, e.g. if the western edge of the contour
vector is 30 and there is an open contour line ending at say
29.99999999, this will not work. If the contour lines were produced
with r.contour, this should work.In practice:
#set the region around contour
v.in.region output=region_line type=line
v.patch input=contour,region_line output=patched
v.clean input=patched@paolo type=line tool=snap thresh=1 output=patched_1
v.clean input=patched@paolo type=line tool=break output=patched_break
v.type input=patched_break@paolo output=patched_break_boundaries type=line,boundary
v.centroids input=patched_break_boundaries output=polygonsIt mostly works, but apparently breaking does not (only closed rings become different
polygons).
Why does breaking not work? Maybe you need remove duplicates and clean
small angles at nodes. You could try
v.clean input=patched@paolo type=line tool=snap,break,rmdupl,rmsa
thresh=1,0,0,0 output=patched_1
or in grass 7
v.clean input=patched@paolo type=line tool=snap thresh=1 output=patched_1 -c
Markus M
Il 27/01/2012 18:53, Markus Metz ha scritto:
The only two options I can think of is giving v.edit a try, otherwise
hand-editing.
Urgh! Too bad, thanks anyway.
Why does breaking not work? Maybe you need remove duplicates and clean
small angles at nodes. You could try
v.clean input=patched@paolo type=line tool=snap,break,rmdupl,rmsa
thresh=1,0,0,0 output=patched_1
I'm not quite sure break do not work: new nodes are there, but in subsequent steps
they are not treated as closed polygons.
Thanks.
--
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Sample location here:
http://int.faunalia.it/~paolo/test.tar.gz
Confirmed by other users.
Thanks.
Il 27/01/2012 18:53, Markus Metz ha scritto:
The only two options I can think of is giving v.edit a try, otherwise
hand-editing.
Urgh! Too bad, thanks anyway.
Why does breaking not work? Maybe you need remove duplicates and clean
small angles at nodes. You could try
v.clean input=patched@paolo type=line tool=snap,break,rmdupl,rmsa
thresh=1,0,0,0 output=patched_1
I'm not quite sure break do not work: new nodes are there, but in subsequent steps
they are not treated as closed polygons.
Thanks.
--
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
On Sun, Feb 12, 2012 at 8:58 PM, Paolo Cavallini <cavallini@faunalia.it> wrote:
Sample location here:
http://int.faunalia.it/~paolo/test.tar.gz
Confirmed by other users.
Thanks.
Hmm. Breaking does indeed not work, even combining it with a bunch of
other cleaning tools. No quick solution here...
Markus M
Il 27/01/2012 18:53, Markus Metz ha scritto:
The only two options I can think of is giving v.edit a try, otherwise
hand-editing.Urgh! Too bad, thanks anyway.
Why does breaking not work? Maybe you need remove duplicates and clean
small angles at nodes. You could try
v.clean input=patched@paolo type=line tool=snap,break,rmdupl,rmsa
thresh=1,0,0,0 output=patched_1I'm not quite sure break do not work: new nodes are there, but in subsequent steps
they are not treated as closed polygons.Thanks.
--
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc