[GRASS-user] voronoi for polygons

hi martin!

i'm not sure what is wrong with v.select, but i can show a second approach how
to derive voronoi polygons (restriction: doesn't work for adjacent polygons):

- convert the selected polygons to raster (v.to.rast)
- switch null() values to 1 and pixels with values to null() (r.mapcalc)
- thin raster (r.thin) several iterations
- convert thinned raster to vector and make polygons (r.to.vect,...)

this works for me
/martin

********************
Hello,

I want to calculate voronoi areas for polygons, but I am stuck in
the "query-part".

using spearfish data I did:

v.extract input=fields at PERMANENT output=fields_extract list=41,36,46,21

v.to.points input=fields_extract output=fields_extract_points type=boundary

v.voronoi input=fields_extract_points output=fields_extract_points_voron

now I wanted to
- group all voronoi polygons which belong to points of one polygon (GIS query
overlap)
- calculate area of merged voronoi polygons and assign them to each original
polygon

but:

v.select operator=overlap gives:

v.select binput=fields_extract_points_voron_clean ainput=fields_extract_clean
atype=area btype=area output=test operator=overlap
Processing ainput areas ...
100%
Writing attributes ...
Layer 1
v.select complete.
Building topology ...
0 primitives registered
0 areas built
0 isles built
Attaching islands:
Attaching centroids: Topology was built.
Number of nodes : 0
Number of primitives: 0
Number of points : 0
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0

anything wrong with the command?
I did it as well without b/atype=area but same result.

The problem how to calculate areas is not yet tackled ,-)

I appreciate any hint, Martin

________________________________________________________________________________

Mag. Martin Rutzinger

rutzinger@alps-gmbh.com
alpS - Natural Hazard Management
http://www.alps-gmbh.com

martin.rutzinger@uibk.ac.at
Institute for Geography, University of Innsbruck
http://geowww.uibk.ac.at

Hello Martin,

On Wednesday 09 August 2006 17:22, Martin Rutzinger wrote:

i'm not sure what is wrong with v.select, but i can show a second approach
how to derive voronoi polygons (restriction: doesn't work for adjacent
polygons):

thanks for your help, I tried your approach, but having polygons as input (not
adjacent ones) and using them as base for voronoi polygons between polygons,
this approach does not work for me or I misunderstood you:

- convert the selected polygons to raster (v.to.rast)

ok

- switch null() values to 1 and pixels with values to null() (r.mapcalc)

it works for my base polygons, because they are not adjacent, but not for my
voronoi polygons. I have no null() values because my voronoi polygons are
adjacent and cover the whole location

- thin raster (r.thin) several iterations

that does not work due to the previous problem, but how do you distinguish
between voronoi polygons belonging to the same base polygon and vornoi
polygons belonging to the base polygons in the neighbourhood? Extracting the
border between two voronoi polygon groups (for 2 base polygons) would be
interesting, but I have no idea how to tell GRASS which line that is.

- convert thinned raster to vector and make polygons (r.to.vect,...)

regards, Martin

this works for me
/martin

********************
Hello,

I want to calculate voronoi areas for polygons, but I am stuck in
the "query-part".

using spearfish data I did:

v.extract input=fields at PERMANENT output=fields_extract list=41,36,46,21

v.to.points input=fields_extract output=fields_extract_points type=boundary

v.voronoi input=fields_extract_points output=fields_extract_points_voron

now I wanted to
- group all voronoi polygons which belong to points of one polygon (GIS
query overlap)
- calculate area of merged voronoi polygons and assign them to each
original polygon

but:

v.select operator=overlap gives:

v.select binput=fields_extract_points_voron_clean
ainput=fields_extract_clean atype=area btype=area output=test
operator=overlap
Processing ainput areas ...
100%
Writing attributes ...
Layer 1
v.select complete.
Building topology ...
0 primitives registered
0 areas built
0 isles built
Attaching islands:
Attaching centroids: Topology was built.
Number of nodes : 0
Number of primitives: 0
Number of points : 0
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0

anything wrong with the command?
I did it as well without b/atype=area but same result.

The problem how to calculate areas is not yet tackled ,-)

I appreciate any hint, Martin

___________________________________________________________________________
_____

Mag. Martin Rutzinger

rutzinger@alps-gmbh.com
alpS - Natural Hazard Management
http://www.alps-gmbh.com

martin.rutzinger@uibk.ac.at
Institute for Geography, University of Innsbruck
http://geowww.uibk.ac.at

hi martin w.!

these steps...

- convert the selected polygons to raster (v.to.rast)
- switch null() values to 1 and pixels with values to null() (r.mapcalc)
- thin raster (r.thin) several iterations
- convert thinned raster to vector and make polygons (r.to.vect,...)

...derive voronoi polygons from your 'input polygons' directly so that you need
not to "group all voronoi polygons which belong to points of one polygon"

see:
http://geo4.uibk.ac.at/users/rutzinger/download/topology5_grass_fire_poly.jpg

if you have done that, you have to assign the cat-values of your 'input polygons
to the 'voronoi polygons'. i think this should be possible with v.distance, but
i'm not sure.

hope this helps
martin r.

Zitat von Martin Wegmann <wegmann@biozentrum.uni-wuerzburg.de>:

Hello Martin,

On Wednesday 09 August 2006 17:22, Martin Rutzinger wrote:
> i'm not sure what is wrong with v.select, but i can show a second approach
> how to derive voronoi polygons (restriction: doesn't work for adjacent
> polygons):

thanks for your help, I tried your approach, but having polygons as input
(not
adjacent ones) and using them as base for voronoi polygons between polygons,
this approach does not work for me or I misunderstood you:

> - convert the selected polygons to raster (v.to.rast)
ok

> - switch null() values to 1 and pixels with values to null() (r.mapcalc)
it works for my base polygons, because they are not adjacent, but not for my
voronoi polygons. I have no null() values because my voronoi polygons are
adjacent and cover the whole location

> - thin raster (r.thin) several iterations
that does not work due to the previous problem, but how do you distinguish
between voronoi polygons belonging to the same base polygon and vornoi
polygons belonging to the base polygons in the neighbourhood? Extracting the
border between two voronoi polygon groups (for 2 base polygons) would be
interesting, but I have no idea how to tell GRASS which line that is.

> - convert thinned raster to vector and make polygons (r.to.vect,...)

regards, Martin

> this works for me
> /martin
>
>
> ********************
> Hello,
>
> I want to calculate voronoi areas for polygons, but I am stuck in
> the "query-part".
>
> using spearfish data I did:
>
> v.extract input=fields at PERMANENT output=fields_extract list=41,36,46,21
>
> v.to.points input=fields_extract output=fields_extract_points type=boundary
>
> v.voronoi input=fields_extract_points output=fields_extract_points_voron
>
>
> now I wanted to
> - group all voronoi polygons which belong to points of one polygon (GIS
> query overlap)
> - calculate area of merged voronoi polygons and assign them to each
> original polygon
>
> but:
>
> v.select operator=overlap gives:
>
> v.select binput=fields_extract_points_voron_clean
> ainput=fields_extract_clean atype=area btype=area output=test
> operator=overlap
> Processing ainput areas ...
> 100%
> Writing attributes ...
> Layer 1
> v.select complete.
> Building topology ...
> 0 primitives registered
> 0 areas built
> 0 isles built
> Attaching islands:
> Attaching centroids: Topology was built.
> Number of nodes : 0
> Number of primitives: 0
> Number of points : 0
> Number of lines : 0
> Number of boundaries: 0
> Number of centroids : 0
> Number of areas : 0
> Number of isles : 0
>
> anything wrong with the command?
> I did it as well without b/atype=area but same result.
>
> The problem how to calculate areas is not yet tackled ,-)
>
> I appreciate any hint, Martin
>

Hello Martin R.,

that's great, now I understand your concept.
I was locked in the "v.to.points" and "v.voronoi" idea and did not see the
raster way.

regards, Martin

On Thursday 10 August 2006 19:13, Martin Rutzinger wrote:

hi martin w.!

these steps...

- convert the selected polygons to raster (v.to.rast)
- switch null() values to 1 and pixels with values to null() (r.mapcalc)
- thin raster (r.thin) several iterations
- convert thinned raster to vector and make polygons (r.to.vect,...)

...derive voronoi polygons from your 'input polygons' directly so that you
need not to "group all voronoi polygons which belong to points of one
polygon"

see:
http://geo4.uibk.ac.at/users/rutzinger/download/topology5_grass_fire_poly.j
pg

if you have done that, you have to assign the cat-values of your 'input
polygons to the 'voronoi polygons'. i think this should be possible with
v.distance, but i'm not sure.

hope this helps
martin r.

Zitat von Martin Wegmann <wegmann@biozentrum.uni-wuerzburg.de>:
> Hello Martin,
>
> On Wednesday 09 August 2006 17:22, Martin Rutzinger wrote:
> > i'm not sure what is wrong with v.select, but i can show a second
> > approach how to derive voronoi polygons (restriction: doesn't work for
> > adjacent polygons):
>
> thanks for your help, I tried your approach, but having polygons as input
> (not
> adjacent ones) and using them as base for voronoi polygons between
> polygons,
>
> this approach does not work for me or I misunderstood you:
> > - convert the selected polygons to raster (v.to.rast)
>
> ok
>
> > - switch null() values to 1 and pixels with values to null()
> > (r.mapcalc)
>
> it works for my base polygons, because they are not adjacent, but not for
> my voronoi polygons. I have no null() values because my voronoi polygons
> are adjacent and cover the whole location
>
> > - thin raster (r.thin) several iterations
>
> that does not work due to the previous problem, but how do you
> distinguish between voronoi polygons belonging to the same base polygon
> and vornoi polygons belonging to the base polygons in the neighbourhood?
> Extracting the border between two voronoi polygon groups (for 2 base
> polygons) would be interesting, but I have no idea how to tell GRASS
> which line that is.
>
> > - convert thinned raster to vector and make polygons (r.to.vect,...)
>
> regards, Martin
>
> > this works for me
> > /martin
> >
> >
> > ********************
> > Hello,
> >
> > I want to calculate voronoi areas for polygons, but I am stuck in
> > the "query-part".
> >
> > using spearfish data I did:
> >
> > v.extract input=fields at PERMANENT output=fields_extract
> > list=41,36,46,21
> >
> > v.to.points input=fields_extract output=fields_extract_points
> > type=boundary
> >
> > v.voronoi input=fields_extract_points
> > output=fields_extract_points_voron
> >
> >
> > now I wanted to
> > - group all voronoi polygons which belong to points of one polygon (GIS
> > query overlap)
> > - calculate area of merged voronoi polygons and assign them to each
> > original polygon
> >
> > but:
> >
> > v.select operator=overlap gives:
> >
> > v.select binput=fields_extract_points_voron_clean
> > ainput=fields_extract_clean atype=area btype=area output=test
> > operator=overlap
> > Processing ainput areas ...
> > 100%
> > Writing attributes ...
> > Layer 1
> > v.select complete.
> > Building topology ...
> > 0 primitives registered
> > 0 areas built
> > 0 isles built
> > Attaching islands:
> > Attaching centroids: Topology was built.
> > Number of nodes : 0
> > Number of primitives: 0
> > Number of points : 0
> > Number of lines : 0
> > Number of boundaries: 0
> > Number of centroids : 0
> > Number of areas : 0
> > Number of isles : 0
> >
> > anything wrong with the command?
> > I did it as well without b/atype=area but same result.
> >
> > The problem how to calculate areas is not yet tackled ,-)
> >
> > I appreciate any hint, Martin