Monday, April 11, 2011

Load and Display an ESRI ArcGrid ASCII file in gvSIG

gvSIG can load and display DEMs in ESRI ArcGrid ASCII format. However, an ArcGrid file I loaded was displayed in gvSIG but the result was not what I expected. See the screen shot below.

After exploring the gvSIG interface, I figured out that the default void or no data value gvSIG was expecting was different from what I had in my ArcGrid ASCII file; it seems that gvSIG does not use the NODATA keyword in the ArcGrid file. To get around this, I had to change the void value gvSIG is expecting to match my data and all would be well.

If you find your DEM file is not displaying as you expected, then the following steps might help.

Load an ESRI ArcGrid ASCII file
  1. Start up gvSIG. Open a View.

  2. Select View | Add Layer.

    The Add layer dialog box appears.

  3. Click Add.

    The Open dialog box appears.

  4. Browse and select an ESRI ArcGrid ASCII file, e.g. arcgrid.asc. Click Open.

    The selected file is added to the Layers list.

  5. Click OK.

    The file is displayed in the view.
Changing the Void or No data value for the DEM layer
  1. In the legend or table of contents, select the arcgrid.asc layer.
  2. Mouse right click on the arcgrid.asc layer.

    A pop up menu appears.

  3. Select Raster properties.

    The Raster properties dialog box appears.

  4. Click the General tab.

  5. Click the No data drop down list. Choose Custom.

  6. In the No data Value field, type in -9999. Click Save as default.

    The Select an Option dialog box appears.

  7. Click Yes.
  8. Click Recalculate statistics.

    The statistics are updated. Notice that the Minimum does not show the -9999 void value anymore.

  9. Click Apply. Click Accept.

    The DEM is displayed in grey scale.
Change the Color table of a grid layer
  1. Mouse right click on the arcgrid.asc layer in the Legend/TOC.

    A pop up menu appears.

  2. Choose Color table.

    The Color table dialog box appears.

  3. Toggle on Activate color table.
  4. Choose a pre-defined scheme, e.g. elevation.

  5. Click Accept.

    The DEM is displayed with the selected color table.
Setting the Global Void or No data value

If I had to set the void value for many ArcGrid ASCII files, it would be quite tedious to do it file by file. It would be better to change the gvSIG preferences and set the global no data value as follows. 
  1. Select File | Preferences.

    The Preferences dialog box appears.

  2. Click Raster.
  3. In the No data value field, type in -9999 or any number which matches the void value for your DEM data.
  4. Click Accept.

    The change is saved.

No comments: