[GRASS-user] raster pixel value
Nikos Alexandris
nik at nikosalexandris.net
Thu Mar 14 11:00:24 PDT 2019
Francois Chartier:
>>I am asking a question on the fundamentals not on a particular example on
>>how the value within a raster cell is determined when multiple vector data
>>points are located within a raster cell footprint.
>>I use RST mostly and sometimes IDW for vector data points.
Nikos Alexandris:
>Then, from https://grass.osgeo.org/grass76/manuals/rasterintro.html:
>
>"Raster input maps are automatically cropped/padded and rescaled (using
>nearest-neighbour resampling) to match the current region."
[..]
Here a visual example using this
ftp://ftp.soilgrids.org/data/aggregated/5km/OCDENS_M_sl1_5km_ll.tif
raster map in a GRASS GIS Location:
```
grass -c OCDENS_M_sl1_5km_ll.tif /geoyeux/grassdb/global/soil_grids/
r.in.gdal input=OCDENS_M_sl1_5km_ll.tif output=OCDENS_M_sl1_5km_ll
```
Select a random point and grow over it a 10^2 box
```
center_n=37.176279; center_e=22.839542 ;offset=0.25
g.region -g \
e=$(echo $center_e + $offset |bc) \
w=$(echo $center_e - $offset |bc) \
s=$(echo $center_n - $offset |bc) \
n=$(echo $center_n + $offset |bc) \
res=0.05
projection=3
zone=0
n=37.426279
s=36.926279
w=22.589542
e=23.089542
nsres=0.05
ewres=0.05
rows=10
cols=10
cells=100
```
Clean file receiving the rendering, then draw the map’s cell values
```
d.erase
d.rast.num OCDENS_M_sl1_5km_ll at PERMANENT text_color=red grid_color=gray
```
Here https://i.imgur.com/2L9dWgX.png red are the original values.
Upscale
```
g.region -g res=0.1
projection=3
zone=0
n=37.426279
s=36.926279
w=22.589542
e=23.089542
nsres=0.1
ewres=0.1
rows=5
cols=5
cells=25
```
And over-draw the "new" map
```
d.rast.num OCDENS_M_sl1_5km_ll at PERMANENT text_color=blue grid_color=blue
```
Here https://i.imgur.com/bYgH6io.png blue are the resampled values.
Nikos
More information about the grass-user
mailing list