GRASS GIS for ArcGIS users: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(→‎Raster algebra: basic info)
(→‎Raster algebra: operators, use () to denote functions)
Line 29: Line 29:


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.
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 ===
{| class="wikitable sortable"
|-
! ArcGIS
! GRASS GIS
! Notes
|-
| &
| &&
| Boolean (logical) and operator is one ampersand (<tt>&</tt>) in ArcGIS. In GRASS GIS, boolean and operator is two ampersands (<tt>&&</tt>) which is the same as in C. Note that <tt>&</tt> means bitwise and operator in GRASS GIS (as well as in Python or C). There is also <tt>&&&</tt> 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 (<tt>!</tt>) which is the same as in C. The ArcGIS equivalent is tilde (<tt>~</tt>) 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 (<tt>^</tt>) 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 <tt>xor()</tt>.
|}
See all operators in GRASS GIS in {{cmd|r.mapcalc}} manual.


=== Functions ===
=== Functions ===
Line 38: Line 65:
! Notes
! Notes
|-
|-
| Con
| Con()
| if
| if()
|
|
|-
|-
| IsNull
| IsNull()
| isnull
| isnull()
|-
|-
| Int
| Int()
| int
| int()
|
|
|-
|-
| Float
| Float()
| float, double
| 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.
| 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.
|}
|}

Revision as of 02:58, 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 or its convenient GUI wrapper Raster Map Calculator.

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() if()
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

See also