Importing Various Types of Vector and Raster Data
Submitted by dylan on Sat, 2005-11-12 01:00.
Generic data import and export commands rely on the GDAL/OGR library to be installed correctly. If you have installed GRASS via a binary package, chances are that these commands will work fine. If you have compiled GRASS and GDAL from source, and have not re-compiled GDAL with GRASS support then raster export via r.out.gdal will not work. See this page for details.
The following examples assume that all of the input data has been projected to a consistant coordinate system, and that an appropriate GRASS location has been created. Command names are in boldface type, input files are red, and the resulting GRASS data are in green. Figures are provided for additional context, and are referenced by input/output file name in the example code.
Vector Import
Raster Import
Text File Import
- Import an ascii file of x,y,z records from a GPS:
#input_file: meters_x | meters_y | meters_z
665015|4036139|100
659998|4039460|123
659651|4039686|244
659466|4039621|400
#-----
v.in.ascii -z in=input_file output=gps_points
- Import an ascii file with variable delimiters
# reformat input text file to single-space delimeted
awk '{print $1, $2, $3}' classes/summer_2005/SSC105/maps/pit_locations.xy | v.in.ascii fs=" " x=1 y=2 out=ssc105s
# export to ESRI shapefile with projection stored in .prj file
v.out.ogr -e --v type=point in=ssc105s dsn=ssc105s.shp
GPS Import
|