ARC/INFO to grass

Jianping Xu jianp at ocean.rutgers.edu
Fri May 13 10:15:01 EDT 1994


> I have to use some data from ARC/INFO. Before I go ahead I would like to know what is the "best" (less problematic!) format to import raster data from Arc into GRASS. 
> Would the Arc/Info export format be ok?
> Thanks in advance.
> 
> ^Angela
> 

I wrote a GRASS script (you can only run it in GRASS environment) 
to do the job. But it does NOT take care of attributes etc.
Also, you have to export a GRID as an ASCII file first.


Jianping Xu	jianp at ocean.rutgers.edu

-------- cut here ------------
#!/bin/sh

####################################################
# 	gridascii2r.sh	(GRASS shell script)
#
# Syntax:	gridascii2r.sh grid_ascii raster_out
#
# Jianping Xu, Rutgers University
# 12/11/93
####################################################

if [ $# != 2 ]
then
	echo 
	echo "Usage:	gridascii2r.sh grid_ascii raster_out"
	exit 1
fi


IN=$1
OUT=$2


### build header for the GRASS ascii-raster file from the header of grid file

head -6 $IN | awk '{print $1"=" $2}' > /tmp/$$

. /tmp/$$
rm -f /tmp/$$

north=`echo "scale=2;${yllcorner} + ${cellsize} * ${nrows}" | bc`
south=$yllcorner
east=`echo "scale=2;${xllcorner} + ${cellsize} * ${ncols}" | bc`
west=$xllcorner
rows=$nrows
cols=$ncols

echo "north:	$north" >  /tmp/$$
echo "south:	$south" >> /tmp/$$
echo "east:	$east"  >> /tmp/$$
echo "west:	$west"  >> /tmp/$$
echo "rows:	$rows"  >> /tmp/$$
echo "cols:	$cols"  >> /tmp/$$


### append input data values to the GRASS raster-ascii file, NODATA becomes 0

tail +7 $IN | sed -e "s/$NODATA_value/0/g" >> /tmp/$$


### convert the ascii file to a standard GRASS raster map

r.in.ascii /tmp/$$ output=$OUT


### finish all
rm -f /tmp/$$




More information about the grass-user mailing list