[GRASS-user] How to get lon/lat at every cell of the map

Hamish hamish_nospam at yahoo.com
Mon Mar 12 19:02:35 EDT 2007


> José Antonio Ruiz Arias wrote:
> > I need access to the geographical location (lon/lat) of every cell
> > in a geo-referenced raster file to project some data according to
> > the geographical location (latitude). I was wondering if it would be
> > possible to get a raster file with the individual values of latitude
> > (or longitude) in every cell of the file from an initial raster map.

Glynn Clements wrote:
> 	r.stats -1g + awk + proj + awk + v.in.ascii + v.to.rast


spearfish example using r.out.xyz and m.proj modules, and UNIX cut,
paste, and tr tools.

(WGS84 LatLon

r.out.xyz roads > file1.txt
r.out.xyz roads | m.proj -od | tr ' ' '|' | tr '\t' '|' > file2.txt
paste -d'|' file1.txt file2.txt | cut -f1-5 -d'|' > file3.txt
v.in.ascii in=file3.txt out=road_pts cat=3

v.to.rast ...

(maybe cut cat off before m.proj so cs2cs doesn't treat it like a z value?)


Hamish




More information about the grass-user mailing list