How to import ArcGIS flow direction into GRASS GIS
As shown in Figure 1, ArcGIS uses powers of two to represent the flow direction starting with \(2^0\) from East in the clockwise direction. Figure 2 shows how the r.watershed module in GRASS GIS encodes similar information in a raster map. This module measures the aspect of each cell in the counter-clockwise direction from East and divides the aspect angle by 45 so that East becomes 8, which is \(8\times 45^\circ=360^\circ\). East is not 0 because this module uses 0 to indicate depression areas.
Using this information, you can import the flow direction raster from ArcGIS into GRASS GIS and convert it to the drainage raster.
- In ArcGIS, right click on the flow direction layer (fdr) → Data → Export Data
- Export fdr as GeoTiff (TIFF format). Output filename fdr.tif in this example.
- In GRASS GIS, import fdr.tif first:
r.in.gdal input=fdr.tif output=fdr
- Convert fdr to drain:
Now, converting drain back to fdr should be straightfoward:
However, this conversion is only for those drain rasters that were converted from ArcGIS flow direction maps (positive cells only). Since r.watershed uses negative integers to flag cells that receive flows from outside the computational extent by default, the above expression would have to be rewritten as follows if you want to handle both ArcGIS-derived drain and r.watershed generated drain rasters:
You can export fdr2 to fdr2.tif using r.out.gdal:
r.out.gdal input=fdr2 output=fdr2.tif