[GRASS-dev] Re: [GRASS GIS] #957: v.voronoi has extra lines in output

GRASS GIS trac at osgeo.org
Tue Sep 20 06:19:21 EDT 2011


#957: v.voronoi has extra lines in output
-----------------------+----------------------------------------------------
 Reporter:  helena     |       Owner:  grass-dev@…              
     Type:  defect     |      Status:  new                      
 Priority:  major      |   Milestone:  6.4.2                    
Component:  Vector     |     Version:  svn-develbranch6         
 Keywords:  v.voronoi  |    Platform:  All                      
      Cpu:  All        |  
-----------------------+----------------------------------------------------

Comment(by mmetz):

 Replying to [comment:10 mlennert]:
 > Replying to [comment:9 mmetz]:
 > > Replying to [comment:8 mlennert]:
 > > >
 > > > g.region vect=precip_30ynormals
 > > > v.voronoi in=precip_30ynormals out=precip_voronoi
 > > >
 > >
 > > The reason why point 82 (and point 112) is missing is that even though
 g.region vect=precip_30ynormals does set the region extents exactly to the
 vector extents, the extents are stored with insufficient precision in
 WIND:
 > {{{
 > > region north: 306221.83019368
 > > vector north: 306221.830193683563
 > >
 > > region south: 27606.895351356
 > > vector south: 27606.895351000000
 > >
 > > region east: 917004.82916485
 > > vector east: 917004.829164845869
 > >
 > > region west: 151768.56824561
 > > vector west: 151768.568245610630
 > }}}
 > >
 > > which in this case causes two points to be excluded.
 >
 > Yes, that was it.
 >
 > g.region vect=precip_30ynormals res=1 -a
 >
 > does the trick for me.
 >
 > Should the precision in the WIND file be increased ? Or the value of
 GRASS_EPSILON to take into account the lesser precision in WIND ?

 I tried adjusting the bounds with GRASS_EPSILON in g.region, to no avail.

 IMHO, this is a more fundamental question. For real projections with units
 = meter or feet, the current precision is more than enough for raster
 operations. All vector operations use double precision for coordinates,
 and here problems start.

 1) The reduced precision in the WIND file can cause vector features to
 fall outside the current region even after g.region vect=myvect.

 2) Even if g.region vect=myvect would store the bounds with full
 precision, from a raster perspective (rows and cols), the vector points
 falling exactly on the eastern and southern border are outside, not inside
 the current region. This is because the row index for a region with nrows
 ranges from 0 to nrows - 1, and (region.north - region.south) / nsres =
 nrows, but nrows > nrows - 1. A vector point exactly on the southern
 border would thus be in row number nrows, one row outside the current
 region. Same for columns and eastern border.

 Therefore it may be a good idea to do the adjustment that g.region
 currently does in

 https://trac.osgeo.org/grass/browser/grass/trunk/general/g.region/main.c#L549

 and following lines not only for window.north == window.south etc. but
 always, to make sure that all vector features are really inside the
 current region? See also ticket #123.

 Markus M

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/957#comment:13>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list