Version 3 (modified by benj, 17 years ago) (diff)

--

Conversion of Vector maps to Raster maps and GeoTiff images using GRASS

  1. Ensure vector maps are in appropriate directory

eg. /tmp/vectors/

  1. Check table names present using db.tables
    db.tables driver=ogr database=/tmp/vectors/ 
    
    outputs (table names in specified directory):
    mny98build
    mny98lines
    mny98roade
    mny98water
    
  1. 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
    
  1. 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
    
  1. Patch imported vector layers together into one map using v.patch
    v.patch input=mny98build,mny98lines,mny98roade,mny98water output=patched_map_name --overwrite
    
  1. 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
    
  1. Convert to 8-bit GeoTiff using r.out.gdal
    r.out.gdal input=raster_map_name type=Byte output=Geotiff_file_name.tif