Opened 9 years ago

Closed 6 years ago

#2718 closed defect (wontfix)

v.mkgrid: one row lost if map extent is less than half that row size

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.0.7
Component: Vector Version: svn-releasebranch70
Keywords: v.mkgrid Cc:
CPU: Unspecified Platform: Unspecified

Description

When creating a grid and the map extent does not reach more than half of a row size, the resulting grid is one row too small (see screenshot).

# NC data
g.region vector=zipcodes_wake -p
v.mkgrid map=grid_10km box=10000,10000
d.vect -c zipcodes_wake 
d.vect grid_10km type=boundary

The issue is likely the rounding in line 329 of mainc.:

        if ((int)(grid_info.num_vect_rows / 2.0 + 0.5) != grid_info.num_rows)

or the code closeby.

Solution: add a flag to enforce full coverage using a different rounding method.

Attachments (1)

v_mkgrid_row_bug.jpg (84.4 KB ) - added by neteler 9 years ago.
Map screenshot with indication of the row problem

Download all attachments as: .zip

Change History (9)

by neteler, 9 years ago

Attachment: v_mkgrid_row_bug.jpg added

Map screenshot with indication of the row problem

comment:1 by neteler, 9 years ago

Milestone: 7.0.27.0.3

Ticket retargeted after milestone closed

comment:2 by neteler, 9 years ago

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:3 by neteler, 9 years ago

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

in reply to:  description comment:4 by mmetz, 9 years ago

Replying to neteler:

When creating a grid and the map extent does not reach more than half of a row size, the resulting grid is one row too small (see screenshot).

The reason is that enlarging the region can be dangerous, e.g. beyond 90N / 90S in latlong. Therefore it is saver to skip one row in the grid if that grid row would extend beyond the current regions bounds.

When setting the current region from a vector, extents and resolution should be adjusted afterwards in order to fit your needs.

Solution: add a flag to enforce full coverage using a different rounding method.

or set your current region accordingly, before running v.mkgrid.

comment:5 by martinl, 9 years ago

Milestone: 7.0.47.0.5

comment:6 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:7 by neteler, 7 years ago

Milestone: 7.0.67.0.7

comment:8 by martinl, 6 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.