[GRASSLIST:7595] Re: how does v.to.rast work...
Zaboj Hrazsky, DAPHNE CR
zaboj.hrazsky at daphne.cz
Mon Jul 18 12:50:07 EDT 2005
Zaboj Hrazsky, DAPHNE ČR napsal(a):
> Hi
>
> One can say daily task...
>
> I need to get rasters with cell 100m from large vector file with
> variable area of polygons: from 20 m2 to hectars. I must not lost any
> occurence of small polygons (which often are generalized out in such
> cases). The best result for me is raster with values of "my vector" area
> in each cell, but also the only presence/absence in 100m grid can be
> used for further analysis.
>
> There are more ways:
>
> A) use v.mkgrid and overlay these vectors works well, but in case of 1
> 400 000 cells in grid I've found some limits :-(.
>
> v.mkgrid map=grid100 grid=2926,4728 position=region
> Creating vector grid ...
> Writing out vector rows ...
> Writing out vector columns ...
> Creating centroids ...
> dbmi: Protocol error (invalid table/column name or unsupported column
> type)
> ERROR: Cannot insert row: insert into gridall values ( 822223, 174,
> 4279 )
>
>
>
> B) use v.to.rast
>
> B1) plain v.to.rast - see file v.to.rast_centroids.png - leave many
> pieces outside the result raster. What is the algorithm, how does GRASS
> know which cell falls in resultant raster?
>
> B2) to add category to vector boundaries and run v.to.rast ... see
> boundary.png ... the result raster eats to much ... empty cells were
> involved, Question is why?
>
> B3) the most complicated, but with best results now: v.to.rast in small
> (5m or less) cell size -> r.to.vect feature=point -> v.to.rast in 100m
> cell size works with points well. I tried to use v.to.points and patch
> these "linepoints" and "rasterpoints" before second v.to.rast, but with
> no better result.
>
> B4) convert raster with small size cell direct to 100m raster, but I
> didn't find any functionality which can simulate the Agregate() function
> known from ESRI GIS products, which sumarize values from finer raster
> into cell of coarser one. Any mc
>
>
> There is no C for me (not programator :), but maybe anybody can navigate
> me a bit ...
>
> Thanks for your time
>
I found the solution on:
http://grass.gdf-hannover.de/twiki/bin/view/GRASS/AggregateValues
shortly:
g.region res=REQUIRED_RESOLUTION
r.random.cells out=BASE dist=0
g.region res=ORIGINAL_RESOLUTION
r.statistics base=BASE cover=ORIG_RASTER method=sum out=AGGREG_RASTER
aggregated values are stored as labels (accesible as @AGGREG_RASTER in
r.mapcalc modul), for final raster run:
g.region res=REQUIRED_RESOLUTION
r.mapcalc FINAL_AGGREG_RASTER=@AGGREG_RASTER
thats it, but could me somebody direct to any description of v.to.rast
mechanism?
Thanks... Zaboj
More information about the grass-user
mailing list