[GRASS-user] v.voronoi error: Found 0 points/centroids, but at least 2 are needed

Dear All,

I am a linux veteran and a grass newbie comfortable with
file format conversions and most interested in grass
v.* commands because of its rich algorithms and
the possibility of scripting/automation.

I imported the attached geojson file like this:
    v.in.ogr input=tkec.geojson output=tkec
and tried these two commands:
    v.delaunay input=tkec output=tkecdt
    v.voronoi input=tkec output=tkecv
The Delaunay triangulation works perfectly and looks nice
after I exported it and displayed it in some other program.
The Voronoi diagram command, however, gives the error message:
    Found 0 points/centroids in <tkec@work>, but at least 2 are needed

I tried it in grass 7.0.3 of lubuntu 16.04 and
grass 7.2.0 of lubuntu 17.04 .
The error messages are the same.
Did I miss some steps before calling v.voronoi?
Many thanks in advance for your help!

--
『我的野蠻工讀生』用高昂的『下賊船的代價』
綁架了我的文件! (請分別搜尋)
Chao-Kuei Hung 洪朝貴

PGP Key ID: 4096R/5828A7A7
Fingerprint: 67AF B5AB 5242 3E99 16D7 EAF8 A94D 2C92 5828 A7A7

(attachments)

tkec.geojson (106 KB)

On Sat, Nov 25, 2017 at 3:07 AM, 洪朝貴 <ckhung@cyut.edu.tw> wrote:

Dear All,

I am a linux veteran and a grass newbie comfortable with
file format conversions and most interested in grass
v.* commands because of its rich algorithms and
the possibility of scripting/automation.

I imported the attached geojson file like this:
v.in.ogr input=tkec.geojson output=tkec
and tried these two commands:
v.delaunay input=tkec output=tkecdt
v.voronoi input=tkec output=tkecv
The Delaunay triangulation works perfectly and looks nice
after I exported it and displayed it in some other program.
The Voronoi diagram command, however, gives the error message:
Found 0 points/centroids in tkec@work, but at least 2 are needed

I tried it in grass 7.0.3 of lubuntu 16.04 and
grass 7.2.0 of lubuntu 17.04 .
The error messages are the same.
Did I miss some steps before calling v.voronoi?

v.voronoi uses the current region (the algorithm requires this), therefore you need to set an appropriate computational region first, e.g. with

g.region -pa vect=tkec res=1

before using v.voronoi.

Many thanks in advance for your help!

HTH,

Markus M


『我的野蠻工讀生』用高昂的『下賊船的代價』
綁架了我的文件! (請分別搜尋)
Chao-Kuei Hung 洪朝貴

PGP Key ID: 4096R/5828A7A7
Fingerprint: 67AF B5AB 5242 3E99 16D7 EAF8 A94D 2C92 5828 A7A7


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Nov 25, 2017 11:48 AM, “Markus Metz” <markus.metz.giswork@gmail.com> wrote:

On Sat, Nov 25, 2017 at 3:07 AM, 洪朝貴 <ckhung@cyut.edu.tw> wrote:

Did I miss some steps before calling v.voronoi?

v.voronoi uses the current region (the algorithm requires this), therefore you need to set an appropriate computational region first, e.g. with

g.region -pa vect=tkec res=1

before using v.voronoi.

Would it make sense to print the used region settings to help the user?

Best,
markusN

Thank you Markus! It works now.

Printing the current region could help.
Re-wording the manual page may also help.
"Unlike most other vector functions, setting the
computation region is mandatory in order to deal with
infinite regions in the Voronoi diagrams."
Or something prominent like that.
I read somewhere that vector operations are not
affected by the region setting, and had success with
v.distance and v.delaunay without ever setting it.
The v.voronoi manual says
"The bounds of the output map are limited by the current region."
but I somehow ignored it as something to worry about later
if and when I get some output :slight_smile:

--
『我的野蠻工讀生』用高昂的『下賊船的代價』
綁架了我的文件! (請分別搜尋)
Chao-Kuei Hung 洪朝貴

PGP Key ID: 4096R/5828A7A7
Fingerprint: 67AF B5AB 5242 3E99 16D7 EAF8 A94D 2C92 5828 A7A7

2017-11-25 20:48 GMT+08:00 Markus Neteler <neteler@osgeo.org>:

On Nov 25, 2017 11:48 AM, "Markus Metz" <markus.metz.giswork@gmail.com>
wrote:

On Sat, Nov 25, 2017 at 3:07 AM, 洪朝貴 <ckhung@cyut.edu.tw> wrote:

...

> Did I miss some steps before calling v.voronoi?

v.voronoi uses the current region (the algorithm requires this), therefore
you need to set an appropriate computational region first, e.g. with

g.region -pa vect=tkec res=1

before using v.voronoi.

Would it make sense to print the used region settings to help the user?

Best,
markusN

On Sat, Nov 25, 2017 at 2:43 PM, 洪朝貴 <ckhung@cyut.edu.tw> wrote:

Thank you Markus! It works now.

Printing the current region could help.
Re-wording the manual page may also help.
“Unlike most other vector functions, setting the
computation region is mandatory in order to deal with
infinite regions in the Voronoi diagrams.”
Or something prominent like that.

The first line of the manual

“v.voronoi - Creates a Voronoi diagram in current region from an input vector map containing points or centroids.”

could be rephrased to

“v.voronoi - Creates a Voronoi diagram constrained to the extents of the current region from an input vector map containing points or centroids.”

I read somewhere that vector operations are not
affected by the region setting, and had success with
v.distance and v.delaunay without ever setting it.
The v.voronoi manual says
“The bounds of the output map are limited by the current region.”
but I somehow ignored it as something to worry about later
if and when I get some output :slight_smile:

It is something to worry about particularly when you get no output :wink:

We could change the error message

“Found 0 points/centroids in tkec@work, but at least 2 are needed”

to something like

“Found 0 points/centroids in tkec@work, but at least 2 are needed. Please verify that the current region extents are covering at least parts of the input map.”

Markus M


『我的野蠻工讀生』用高昂的『下賊船的代價』
綁架了我的文件! (請分別搜尋)
Chao-Kuei Hung 洪朝貴

PGP Key ID: 4096R/5828A7A7
Fingerprint: 67AF B5AB 5242 3E99 16D7 EAF8 A94D 2C92 5828 A7A7

2017-11-25 20:48 GMT+08:00 Markus Neteler <neteler@osgeo.org>:

On Nov 25, 2017 11:48 AM, “Markus Metz” <markus.metz.giswork@gmail.com>
wrote:

On Sat, Nov 25, 2017 at 3:07 AM, 洪朝貴 <ckhung@cyut.edu.tw> wrote:

Did I miss some steps before calling v.voronoi?

v.voronoi uses the current region (the algorithm requires this), therefore
you need to set an appropriate computational region first, e.g. with

g.region -pa vect=tkec res=1

before using v.voronoi.

Would it make sense to print the used region settings to help the user?

Best,
markusN