Version 6 (modified by emca, 15 years ago) (diff) |
---|
Automatic Conversion of Vector maps to Raster maps and GeoTiff images using GRASS
- Ensure vector maps are in appropriate directory
eg. /tmp/vectors/
- Ensure that the desired output directory for the GeoTiff file exits
- Run 'auto_grass_vector_tiff_conversion [<vector dir>][<path/name> (of the GeoTiff output)]
for example
auto_grass_vector_tiff_conversion tmp/vectors /users/rsg/chrfi/scratch/tiffs/myGeoTiff
Manual Conversion of Vector maps to Raster maps and GeoTiff images using GRASS
- Ensure vector maps are in appropriate directory
eg. /tmp/vectors/
- Check table names present using db.tables
db.tables driver=ogr database=/tmp/vectors/ outputs (table names in specified directory): mny98build mny98lines mny98roade mny98water
- For each table, check column names present using db.columns
db.columns table=mny98build driver=ogr database=/tmp/vectors outputs (columns in specified table, note duplicate column name): FNODE_ TNODE_ LPOLY_ RPOLY_ LENGTH MNY98BUILD MNY98BUILD
- Import vector map using v.in.ogr. Note that if your table has duplicate column names as this example, you will need to rename your columns using the cnames option, the first argument to which is always an extra category field. Note also that for vector maps without a specified projection you must use the -o flag to override the projection check
v.in.ogr -o dsn=/tmp/vectors/ output=mny98build layer=mny98build \ cnames=CAT,FNODE_,TNODE_,LPOLY_,RPOLY_,LENGTH_,MNY98BUILD,MNY98BUILD2 --overwrite
- Patch imported vector layers together into one map using v.patch
v.patch input=mny98build,mny98lines,mny98roade,mny98water output=patched_map_name --overwrite
- Convert to raster map using v.to.rast. Note this converts for the current region only at the current resolution, so be sure that region and resolution are set as desired
v.to.rast input=patched_map_name output=raster_map_name use=val value=100 --overwrite
- Convert to 8-bit GeoTiff using r.out.gdal
r.out.gdal input=raster_map_name type=Byte output=Geotiff_file_name.tif