[GRASS-dev] [GRASS GIS] #3226: v.select: how to handle situation where no features are found

GRASS GIS trac at osgeo.org
Tue Dec 20 08:50:25 PST 2016


#3226: v.select: how to handle situation where no features are found
-------------------------+-------------------------
 Reporter:  mlennert     |      Owner:  grass-dev@…
     Type:  defect       |     Status:  new
 Priority:  normal       |  Milestone:  7.2.1
Component:  Vector       |    Version:  svn-trunk
 Keywords:  v.select     |        CPU:  Unspecified
 Platform:  Unspecified  |
-------------------------+-------------------------
 Luca described the following scenario [https://lists.osgeo.org/pipermail
 /grass-dev/2016-November/083116.html [1]]:

 {{{
 g.region vect=zipcodes -ap

 v.mkgrid map=zipcodes_grid box=10000,10000

 v.category zipcodes_grid opt=report
 Layer/table: 1/zipcodes_grid
 type       count        min        max
 point          0          0          0
 line           0          0          0
 boundary       0          0          0
 centroid      42          1         42
 area           0          0          0
 face           0          0          0
 kernel         0          0          0
 all           42          1         42

 v.select ain=zipcodes_grid bin=zipcodes operator=touches
 out=zipcodes_grid_final --o
 WARNING: Vector map <zipcodes_grid_final> already exists and will be
          overwritten
 Processing features...
  100%
 Processing areas...
  100%
 Writing selected features...
  100%
 Writing attributes...
 WARNING: Array of values to select from column <cat> is empty
 WARNING: Unable to copy table for layer 1
 DBMI-SQLite driver error:
 Unable to create index:
 create unique index  if not exists zipcodes_grid_final_cat on
 zipcodes_grid_final ( cat )
 no such table: main.zipcodes_grid_final

 DBMI-SQLite driver error:
 Unable to create index:
 create unique index  if not exists zipcodes_grid_final_cat on
 zipcodes_grid_final ( cat )
 no such table: main.zipcodes_grid_final

 WARNING: Unable to create index
 WARNING: 97 features from <zipcodes_grid at user1> without category skipped
 Building topology for vector map <zipcodes_grid_final at user1>...
 Registering primitives...
 0 primitives registered
 0 vertices registered
 Building areas...
  100%
 0 areas built
 0 isles built
 Attaching islands...
 Attaching centroids...
 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
 v.select complete. 0 features written to output.
 }}}

 I explained that with the operator 'touches', it is normal that no
 features were found. However, the error message was awkward. In r70103 a
 patch was applied to trunk to count the number of features found and if
 that number = 0 then the user is informed and  no output map is created.

 However, Vaclav remarks:

 > Isn't an empty vector map an expected result in this case? What happens
 > when you do this in GUI (where output is added automatically to Map
 > Display)?

 I don't think that a module should output an empty map. But if you think
 that it should than we can change the patch.

 And yes, the output is automatically added even if it doesn't exist, but I
 would actually consider this a bug in the GUI, not of the module.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3226>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list