7

I would like to collect a table of equivalent or close enough gdal based functions to replace ArcGIS functions (esp in spatial analyst). Are there functions available using gdal to perform the following ArcGIS functions:

  1. Lookup
  2. Zonal statistics
  3. Focal statistics
  4. Nibble
  5. Iterate through raster VAT
  6. Combine
  7. Mosaic

The key is to have a ready reckoner of such functions, so ArcGIS based code can be relatively painlessly changed to one based on gdal.

Aaron
  • 51,658
  • 28
  • 154
  • 317
user1186
  • 111
  • 2
  • 10
  • 29

2 Answers2

6

Here are some options

  1. Lookup: (not sure)
  2. Zonal stats: The GRASS module r.statistics
  3. Focal stats: GRASS r.neighbors
  4. Nibble: (don't know)
  5. Iterate through VAT: I think that the concept of a VAT is specific to Arc*, but r.describe might get close.
  6. Combine: Just use GRASS r.mapcalc
  7. Mosaic: GRASS - r.patch or gdal_merge
user1186
  • 111
  • 2
  • 10
  • 29
Micha
  • 15,555
  • 23
  • 29
  • 2
    As far as I understand the Lookup, the GRASS module r.reclass should do it. – webrian May 04 '15 at 01:51
  • thanks @Micha, will r.describe be able to modify the VAT? – user1186 May 04 '15 at 13:29
  • 2
    For zonal statistics, you can also use r.univar, v.rast.stats, v.vect.stats (see at page bottom of http://grass.osgeo.org/grass70/manuals/keywords.html#zonal%20statistics) – markusN May 04 '15 at 14:20
  • 3
    Please consider to merge your answers also into http://grasswiki.osgeo.org/wiki/Tips_for_Arc_users – markusN May 04 '15 at 14:21
5

In addition to Micha's list, here is how you can nibble with GRASS

1) mask your image with r.mapcalc

2) with the resulting image, interpolate to the nearest neighbour using r.surf.nnbathy

For combine, I would use r.cross but you can also do it using r.mapcalc with this algorithm

For mosaic, I would use gdalbuildvrt: it is often not necessary to create a new file, and you can translate it after if it becomes necessary.

As mentioned by @webrian, r.reclass can be used for lookup.

VAT's are tables, so you can use table editing tools to update them (see e.g. this post)

radouxju
  • 49,636
  • 2
  • 71
  • 144
  • thanks @radoxju, is there a way to replace the setcursor and updatecursor command in ArcGIS? – user1186 May 04 '15 at 13:29
  • insertCursor and updateCursor are the methods to parse the rows of a table in ArcGIS, so I would say YES(you can update a table in QGIS), but it depends on what you want to do. Many things can be done with the field calculator in QGIS, but if you work with raster this question could help : http://gis.stackexchange.com/questions/107996/how-to-do-loops-on-raster-cells-with-python-console-in-qgis – radouxju May 04 '15 at 13:38
  • 1
    By the way, please ask separate questions when you can : you will attract more specific answers. – radouxju May 04 '15 at 13:50
  • sorry about that, will take care... – user1186 May 04 '15 at 13:52