[GRASS-user] two questions: snap and close lines
Paolo Cavallini
cavallini at faunalia.it
Fri Jan 27 07:02:10 EST 2012
Il 26/01/2012 20:41, Markus Metz ha scritto:
> On Mon, Jan 23, 2012 at 8:00 PM, Paolo Cavallini <cavallini at 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 at paolo type=line tool=snap thresh=1 output=patched_1
v.clean input=patched at paolo type=line tool=break output=patched_break
v.type input=patched_break at 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
More information about the grass-user
mailing list