PROBLEM

Floating point grid does not display or label properly

Last Published: April 25, 2020

Description

A floating point grid does not display or label properly in ArcView Spatial Analyst.

Cause

The range of values of the grid is much smaller than the range of values set in the legend.

Solution or Workaround

As a workaround, you can reclassify the floating point grid, then label and symbolize the resulting integer grid to match the original grid. The following script automates this process.

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Paste the following :

    Code:
    '-- Get the original grid legend and write parameters to a temporary table
    theview = av.getactivedoc
    thetheme = theview.getactivethemes.get(0)
    theleg = thetheme.getlegend
    thenum = theleg.getnumclasses - 1
    thevtab = vtab.makenew("c:\temp\class2.dbf".asfilename, dbase)
    thevtab.seteditable(true)
    therecfld = field.make("Recno", #FIELD_DECIMAL, 6,0)
    thelfld = field.make("Label", #FIELD_CHAR, 30, 0)
    therfld = field.make("Range", #FIELD_CHAR, 30, 0)
    theminfld = field.make("Min", #FIELD_DECIMAL, 15, 5)
    themaxfld = field.make("Max", #FIELD_DECIMAL, 15, 5)
    thevtab.addfields({therecfld, thelfld, therfld, theminfld, themaxfld})
    for each i in 0..thenum
    therec = thevtab.addrecord
    theleglist = theleg.returnclassinfo(i)
    thelabel = theleglist.get(0).clone
    therange = theleglist.get(1).clone
    themin = theleglist.get(3).clone
    themax = theleglist.get(4).clone
    thevtab.setvalue(therecfld, therec, (i + 1))
    thevtab.setvalue(thelfld, therec, thelabel)
    thevtab.setvalue(therfld, therec, therange)
    thevtab.setvalue(theminfld, therec, themin)
    thevtab.setvalue(themaxfld, therec, themax)
    theleglist.empty
    end
    thevtab.seteditable(false)

    theleg.save("c:\temp\one.avl".asfilename)

    '-- Reclass grid using the temporary table
    g = thetheme.getgrid.reclass(thevtab, theminfld, themaxfld, therecfld, true)

    '-- Join attributes in temp table to reclass grid
    thegvtab = g.getvtab
    thevalfld = thegvtab.findfield("value")
    thegvtab.join(thevalfld, thevtab, therecfld)
    g2 = g

    '-- Make new legend and assign values, symbols and labels
    thenewleg = legend.make(#SYMBOL_FILL)
    thenewleg.load("c:\temp\one.avl".asfilename, #LEGEND_LOADTYPE_ALL)
    thegtheme = gtheme.make(g2)
    for each j in 0..thenum
    'thel = theg2vtab.returnvalue(thelabelfld, j)
    the2leglist = thenewleg.returnclassinfo(j)
    jj = j + 1
    the2leglist.set(1, jj.asstring)
    the2leglist.set(3, jj)
    the2leglist.set(4, jj)
    thenewleg.setclassinfo(j, the2leglist)
    end

    '-- Set legend and add grid to view
    thegtheme.setlegend(thenewleg)
    theview.addtheme(thegtheme)

  3. Select Compile from the Script menu or click the
    [O-Image] Script compile button
    button.
  4. Open the view and make the problem grid theme active.
  5. Click directly on the script window and click the
    [O-Image] Run compiled script button
    button to run the script.

Article ID:000003535

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic