Difference between revisions of "GRASS GIS for ArcGIS users"

From GRASS-Wiki
Jump to navigation Jump to search
(add arcgis category)
Line 95: Line 95:


== Cost analysis ==
== Cost analysis ==
Cost surface is defined differently in GRASS GIS and ArcGIS. Cost in GRASS GIS is cost to ''cross a cell'' while in ArcGIS it is cost to ''cross one map unit''. So for example we define cost as time and we have 30 m cells and speed is 5 m/s. Then the cost value of the cell is 6 s in GRASS GIS and 0.2 s in ArcGIS.


== See also ==
== See also ==

Revision as of 15:30, 21 August 2015

Projections

ArcGIS supports on-the-fly projection of spatial data while GRASS GIS considers this as a bad practice and requires user to have consistent projection for all the data entering the analysis.

Data, databases and file formats

In ArcGIS, users often have data in different directories on disk. GRASS GIS sets a specific system to organize the data. First, data must be in one directory called GRASS GIS database directory. You can have one or more of these directories on your disk. This directory contains GRASS Locations. All data in one Location have the same projection (coordinate system, datum). Location is a directory which contains GRASS Mapsets. Mapset contains raster and vector maps (layers) and other geospatial data.

Cartography

The standard display in GRASS GIS

3D visualization

In GRASS GIS, the 3D view is integrated into the main graphical user interface (GUI) while in ArcGIS suite, there is a separate tool ArcScene. The GRASS GIS library which is behind the 3D view is called NVIZ. The integration of NVIZ into GUI which is called wxGUI is called wxNVIZ. The 3D visualization is also available as a module called m.nviz.image (usable from command line or Python).

In GRASS GIS, when you are in 2D and you switch to 3D, all raster map layers are automatically added to the 3D view as surfaces. This means that if you have in 2D a digital elevation model, you will see it as a 3D visualization of terrain in 3D. The colors set will be the same colors as in 2D. This is different from ArcScene where the raster layer is initially flat and you have to specify in properties which raster should be used to create the surface.

Raster algebra

Current ArcGIS raster calculator syntax is based on Python and the actual implementation is in Python. In GRASS GIS the map algebra is available through r.mapcalc module (implemented in C) or its convenient GUI wrapper Raster Map Calculator. The r.mapcalc syntax is specifically designed for raster map algebra.

Quotes

In ArcGIS map algebra layer names must be quoted. In GRASS GIS, the quotes are optional and usually not used. There is few cases where it is necessary to use quotes and that is when raster map name contains dashes (which would be interpreted as minus operator). However, best practice is not to use dashes in map names at all (since map name should be ideally also usable without quoting in SQL). When writing Python script and you want it to be really robust. Then you may want to use quiting.

Whitespace

In ArcGIS map algebra operators must be surrounded by spaces. In GRASS GIS, the spaces around operators are optional, however it is a best practice to use them.

Operators

ArcGIS GRASS GIS Notes
& && Boolean (logical) and operator is one ampersand (&) in ArcGIS. In GRASS GIS, boolean and operator is two ampersands (&&) which is the same as in C. Note that & means bitwise and operator in GRASS GIS (as well as in Python or C). There is also &&& which doesn't propagate null values (which is the standard behavior) but instead, threats them as false.
| || Difference between ArcGIS and GRASS GIS in boolean or operator is the same as in the case of Boolean and operator.
~ ! In GRASS GIS the boolean not operator is (one) exclamation mark (!) which is the same as in C. The ArcGIS equivalent is tilde (~) while in GRASS GIS tilde is a bitwise not operator (one's complement) as it can be found in C or Python.
^ xor() A caret (^) in ArcGIS means boolean exclusive or operator while in GRASS GIS it means exponentiation (an arithmetic operation). Boolean exclusive or is in GRASS GIS done using a function xor().

See all operators in GRASS GIS in r.mapcalc manual.

Functions

ArcGIS GRASS GIS Notes
Con(a, b, c), Con(a, b, c, d) if(a, b, c) The most used conditional statement (if-statement) in both ArcGIS and GRASS GIS has raster algebra is a function with three parameters first is the conditional expression (condition), second is value to be used when the condition is fulfilled ("if-part") and third one is the value to be used when the condition is not fulfilled ("else-part"). ArcGIS also supports a syntax with four parameters where the first one is just the raster and the fourth one is SQL conditional expression. GRASS GIS has also a version with four parameters but it is a convenience for the cases where we need to decide among three values based on the the first parameter (raster or expression) being lesser than zero, zero or greater than zero.
Con(a, b) if(a, b, null()) In ArcGIS, the expression Con(a, b) will return NoData (NULL) if a is true (or non-zero). In GRASS GIS, the expression if(a, b) would return 0 (a number zero) in this case. So, we explicitly specify the value null() for the case when a is false (or zero) using third parameter. The general syntax is if(a, b, c) and it is the preferred one because it is explicit and thus one doesn't need to remember the special behavior of the other versions when reading the expression.
SetNull(a, b), SetNull(a, b, c) if(a, null(), b) ArcGIS function SetNull returns NoData (NULL) when first parameter is true. The optional third parameter is SQL query which can be used instead of the expression (the first parameter). The GRASS GIS function for returning NULL when condition is not fulfilled is standard if function used with three parameters where second one is null().
IsNull() isnull()
Int() int()
Float() float(), double() GRASS GIS has two floating point numeric types. First is single precision floating point number (float) with corresponding raster map type is FCELL. Second is double precision floating point number (double) with corresponding raster map type is DCELL.

Further notes

Note that there are different algebras in GRASS GIS, namely it is 3D raster algebra which the same as the standard 2D one with few differences to accommodate 3D rasters and then it is temporal algebra which contains a lot of additional syntax to work with spatio-temporal data.

Cost analysis

Cost surface is defined differently in GRASS GIS and ArcGIS. Cost in GRASS GIS is cost to cross a cell while in ArcGIS it is cost to cross one map unit. So for example we define cost as time and we have 30 m cells and speed is 5 m/s. Then the cost value of the cell is 6 s in GRASS GIS and 0.2 s in ArcGIS.

See also