[GRASS-user] v.to.rast on 3D polygons?

William Kyngesburye woklist at kyngchaos.com
Wed Nov 22 18:09:49 EST 2006


On Nov 22, 2006, at 4:02 PM, Maciej Sieczka wrote:

> William Kyngesburye wrote:
>
> <snip>
>
>> I thought I'd put the elevation into the db table with
>> v.to.db, but there is no z option, just area and perimeter.
>>
>> Any ideas how to get the 3D z value into a raster fill?
>>
>> Is it possible to add a z option for v.to.rast (for areas) and/or  
>> v.to.db?
>
> There is one already in v.to.db - "coor: point coordinates, X,Y or
> X,Y,Z". Does this work with geometries other than point I don't know;
> can you verify?
>
Pretty obvious.  My brain gets on a track (looking for Z by itself)  
and misses something so obvious.  That should work for the workaround  
method, but it would be nice to have a direct access to the Z value  
in v.to.rast.

Seems to work, mostly.  One of my polygons didn't get filled, but has  
a single cell at the centroid.  I looked with v.digit, and the  
topology is correct.  The boundary isn't labelled.

It looks like it's because the raster grid alignment is off a half a  
cell from the resolution.  When I aligned the region to the region's  
resolution, all polygons got filled.

Where this is coming from: I have the SRTM DEMs v2 all imported.   
They are cell-centered, at 3" cell size, so their regions are 1.5"  
off from 3".  ie, a 1 degree tile's region might be:

north:      20:00:01.5N
south:      18:59:58.5N
west:       156:00:01.5W
east:       154:59:58.5W
nsres:      0:00:03
ewres:      0:00:03
rows:       1201
cols:       1201

Then I import the SRTMv2 coast file for the same tile.  Those are  
annoyingly aligned to the cell edges:

north:      20N
south:      19N
west:       156W
east:       155W
nsres:      0:00:03
ewres:      0:00:03
rows:       1200
cols:       1200

But I want a grid, with elevations for the lakes that are in these  
coast files though that's not critical, aligned to the DEM's grid, so  
I can *cleanly* mask off the ocean areas.  With the mask grid a half  
cell off from the DEM grid, resampling will get in the way of a clean  
mask.

Though, I guess since there is so much noise in the SRTM data, I  
could just resample the DEMs to align them to the grid without losing  
too much.  That would reduce some other headaches coming from the  
alignment.  hmmmm....

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

[Trillian]  What are you supposed to do WITH a maniacally depressed  
robot?

[Marvin]  You think you have problems?  What are you supposed to do  
if you ARE a maniacally depressed robot?  No, don't try and answer,  
I'm 50,000 times more intelligent than you and even I don't know the  
answer...

- HitchHiker's Guide to the Galaxy





More information about the grass-user mailing list