[GRASS-user] v.centroids question
John C. Tull
john.tull at wildnevada.org
Wed Mar 19 16:49:35 EDT 2008
On Mar 19, 2008, at 12:53 PM, Nikos Alexandris wrote:
> On Wed, 2008-03-19 at 12:12 -0700, John C. Tull wrote:
>> On Mar 19, 2008, at 11:08 AM, Nikos Alexandris wrote:
>>>> John,
>>>>
>>>> maybe you could try
>>>>
>>>> v.clean with type=line,boundary,centroid,area
>>>> tool=snap,break,rmdupl
>>>> thresh=.01
>>>>
>>>> Not sure but I suspect the "break" tool is what you might need.
>>>
>>> And then of course the rest with v.centroids
>>>
>>
>> Nikos,
>>
>> Thanks for the suggestion. I seem to be getting closer. I ran v.clean
>> as you suggested, then ran v.clean with tool=chdangle and a really
>> big
>> threshold value.
> Ah.. ok!
>
>
>> Now many more areas are available, but there are
>> still quite a few apparently closed polygons that are not being
>> picked
>> up as areas. I'm playing around with different thresholds for snap
>> and
>> various permutations of the various operations.
>
> So, if I understand, the idea is:
>
> lines to boundaries (v.type) > snap (close open boundaries) + chdangle
> (dangles from boundary to line) > v.centroids
>
> Maybe I misunderstood the "break" tool here. I thought it would help
> but
> maybe it's irrelevant (?)
>
> If it's not too much work could you copy-paste your commands (if
> successful)?
>
>
> Thank you,
>
> Nikos
>
Here was what worked best for me. My snap value needed to be pretty
large because I noticed the leftover polygons that were not available
as areas had disconnected lines in the midst of the polygon or
unconnected boundaries. The break option could not have hurt, so it
was a good suggestion. Below is what I ended up doing, although there
may yet be better methods yet undiscovered...
Clean the original road vector
v.clean in=roads_plus out=roads_clean
type=line,boundary,centroid,area tool=snap,break,rmdupl,rmline
thresh=40 --o
Change the lines to boundariess
v.type in=roads_clean out=roads_bounds type=line,boundary --o
Clean the vector again to rid boundaries where they should be lines
v.clean in=roads_bounds out=roads_clean
type=line,boundary,centroid,area tool=chdangle,chbridge
thresh=1000000000,0.01 --o
Make areas
v.centroids in=roads_clean out=roads_areas --o
I lose some resolution when I increase the snap threshold because
snapping seems to prune vertices in lines by snapping those vertices
within the threshold to a single vertex. Is there a way to suppress
this so only vertices at the end of lines are snapped?
Cheers,
John
More information about the grass-user
mailing list