[GRASS-dev] get_row.c: output north/east values? G__.window structure

Markus Neteler neteler at osgeo.org
Tue Aug 26 11:08:03 EDT 2008


On Tue, Aug 26, 2008 at 3:10 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Markus Neteler wrote:
>
>> I try to understand an issue mentioned on grass-user but get only enigmatic
>> error messages:
>>
>> v.extrude -t bldg_cmcl  out=bldg_cmcl_3d height=15
>> elev=el_D792_6m --o
>> WARNING: Vector map <bldg_cmcl_3d> already exists and will be overwritten
>>
>> WARNING: Reading raster map <el_D792_6m at PERMANENT> request for row 220803
>>          is outside region
>> ERROR: Problem reading raster map
>>
...
> Any warning generated there is useless to the end user, as it
> indicates a bug in the code. It's the caller's responsibility to avoid
> requesting rows which lie outside the current region.
>
>
> I've committed fixes to a number of bugs in G_get_raster_sample().
> Apart from trying to read invalid rows, it was deliberately reading
> the wrong rows at the edge of the region, and pretending that nulls
> were zero (they aren't; just because you would like a definite (i.e.
> non-null) answer, that doesn't mean that you can have one).

I have backported this.

> I've also fixed v.sample to deal with the fact that the result may be
> null.
> v.extrude and v.drape also use that function, so they may need similar
> changes.

Does below makes sense for v.extrude?

[neteler at markus v.extrude]$ svn diff
Index: main.c
===================================================================
--- main.c      (revision 33093)
+++ main.c      (working copy)
@@ -405,6 +405,9 @@
            voffset_curr = G_get_raster_sample(fdrast, &window, NULL,
                                               Points->y[k], Points->x[k], 0,
                                               NEAREST);
+           if (G_is_d_null_value(&voffset_curr))
+               continue;
+
            if (k == 0) {
                voffset_dem = voffset_curr;
            }
@@ -425,11 +428,16 @@
            voffset_curr = G_get_raster_sample(fdrast, &window, NULL,
                                               Points->y[k], Points->x[k], 0,
                                               NEAREST);
+           if (G_is_d_null_value(&voffset_curr))
+               continue;
+
            if (type != GV_POINT) {
                voffset_next = G_get_raster_sample(fdrast, &window, NULL,
                                                   Points->y[k + 1],
                                                   Points->x[k + 1], 0,
                                                   NEAREST);
+               if (G_is_d_null_value(&voffset_curr))
+                   continue;
            }
        }


Full example - NC dataset (http://www.grassbook.org/data_menu3rd.php):

g.region rural_1m -p

# P079215 is in PERMANENT
# extract buildings, based on original DXF data set
#
v.extract P079215 out=bldg_resid where="layer='BLDG_RESID_BL'"

# add height of the building
v.extrude -t bldg_resid out=bldg_resid_3d height=10 \
             elev=el_D792_6m

# this should show 3D blocks (and did so until recently!):
nviz el_D792_6m vect=bldg_resid_3d

Loading raster map <el_D792_6m at PERMANENT>...
  99%
Loading raster map <el_D792_6m at PERMANENT>...
Translating colors from raster map <el_D792_6m>...
Vector map <bldg_resid_3d at neteler> loaded (4 features)


There are only 2D polygons shown :(
Also: why only 4 features?

v.info -t bldg_resid_3d
nodes=14
points=0
lines=11
boundaries=0
centroids=0
areas=0
islands=0
faces=0
kernels=0
primitives=11
map3d=1

I would expect faces here. Looking at this:

v.out.ascii bldg_resid_3d format=standard
ORGANIZATION:
DIGIT DATE:
DIGIT NAME:   neteler
MAP NAME:
MAP DATE:     Tue Aug 26 17:02:03 2008
MAP SCALE:    1
OTHER INFO:   Generated by v.extrude from vector map <bldg_resid at PERMANENT>
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  9 1
 638745.93649987 220589.98018792 138.74661255
 638761.33502667 220593.60121917 138.92004395
 638760.72542545 220596.16154429 138.92004395
 638764.00508001 220596.94183385 138.9642334
 638760.90830582 220610.07264411 138.90388489
 638750.36220472 220607.59766316 139.04286194
 638751.27660655 220603.70840738 139.04286194
 638743.14452629 220601.78206753 139.05780029
 638745.93649987 220589.98018792 138.74661255
 1     49
L  5 1
 638773.49047498 220587.26136649 138.49179077
 638776.68478537 220587.38328673 138.49179077
 638776.75793752 220585.12776222 138.28727722
 638773.56362713 220585.00584198 138.49179077
 638773.49047498 220587.26136649 138.49179077
 1     50
[...]

suggests that no longer faces are written by v.extrude.

Despite the new NVIZ/whatever bug, is above patch ok?

Markus


More information about the grass-dev mailing list