[GRASS-user] find (x,y) index of data
Ken Mankoff
mankoff at gmail.com
Thu Feb 4 16:55:13 PST 2016
Hi,
I think I've solved this. I can compute i,j with:
On 2016-02-04 at 16:48, Ken Mankoff <mankoff at gmail.com> wrote:
> I'd like to do additional processing elsewhere (Python), outside of
> grass, based on the index (i,j) of each point in a raster. Is
> it possible to loop through the lon,lat or x,y coordinates in grass,
> perform a calculation, and then also generate the i,j grid index
> values for each point?
>
eval `g.region -pg`
r.out.xyz input=surf output=- fs=, | cut -d"," -f1-2 | while read -r line
do
x=$(echo $line | cut -f1 -d,)
y=$(echo $line | cut -f2 -d,)
i=`echo "(($x)-($w))/$ewres"|bc`
j=`echo "(($y)-($s))/$nsres"|bc`
echo $x $y $i $j
done
-k.
More information about the grass-user
mailing list