10

I have by chance discovered how ArcMap displays special floating point values to the user.

  • +∞ (positive infinity) is displayed as 1.#INF
  • –∞ (negative infinity) would supposedly be displayed as -1.#INF — I haven't verified this one.
  • NaN (not a number) is displayed as a right-aligned <Null> — not to be confused with left-aligned <Null>, which denotes NULL (missing values):

    Screenshot of a table viewed in ArcMap that shows two distinct types of NULL

    (Get unique values in the field calculator does not list NaN at all, by the way.)

But I haven't discovered how to write layer definition queries to select rows based on these special values:

  • ColumnName IS NULL will only select regular NULL values, but non NaN.
  • ColumnName = 1.#INF is rejected as having invalid syntax.

Does anyone know how to do this?


C# ArcObjects code snippet for storing a 1.#INF value to a table field (basic concept):

As requested. Since I'm no longer at work, the following is not the real code I used and I cannot test it right now, but it should produce the effect shown in the screenshot above:

ITable table = …;
int doubleFieldIndex = table.FindField(…);
IRow row = table.CreateRow(); 
row.Value[doubleFieldIndex] = double.PositiveInfinity;
row.Store();
12
  • Excellent Question. I was not aware that NaN is represented as a right aligned <Null>. I too look forward to the answers. btw, What does the right aligned <null> look like in the Search by Attribute window( When you get all distinct values for that Field?) Commented Feb 15, 2012 at 16:28
  • @Devdatta, as far as I can tell, Get unique values does not list NaN at all.
    – stakx
    Commented Feb 15, 2012 at 16:43
  • What sort of data is this? Is this an attribute table of a Grid? Did you import this data from a non-ArcGIS source? Commented Feb 15, 2012 at 17:23
  • @Jakub: This is a table inside a file geodatabase, and the fields shown in the screenshot have type Double. And no, the table has been created and edited with a ArcObjects & ArcMap.
    – stakx
    Commented Feb 15, 2012 at 17:47
  • Yes, but how did you get such values into the fields?
    – whuber
    Commented Feb 15, 2012 at 17:58

1 Answer 1

2

In ArcGIS a single-precision floating-point number has a range of approximately -3.4E38 to 1.2E38.

If you are actually seeing the 1.#INF -1.#INF values displayed in your attribute table (or via MS Access when analyzing attributes) or grid statistics then these might be numbers that fall outside of the range supported by ESRI. And if these number do in fact fall outside of the supported range it is safe to say you will not be able to query for these values. You could try greater and less then the maximum and minimum (-3.4E38 to 1.2E38) and see what it returns but I am doubtful the query will work at all if the table/field contain unsuported range of values.

This source suggests that such values might have been imported from a 3-rd party non-ESRI application. You might need to convert the values to a supported range of values prior to importing to an ESRI product.

As for the NULL/NuN values, it would be usefull to know exactly what we are looking at in your example; An attrubute table of a grid, shapefile, geodatabase feature class, etc. For example, shapefiles cannot store NULL values so if a feature class thant contains NULL values is converted to a shapefile those are stored as various other values ("",0,NuN?, etc.) but when displayed in an ArcMap attribute table they are still visually represented as "<Null>". It's possible that the alignment of the NULLs in your attribute table is a such situation. I am only speculating about why you are able to query the left aligned NULLs but not the right-aligned NULLs but if this is a shapefile, try importing into a geodatabase then run the query again. Chances are that all of these will be converted to proper NULL values.

2
  • @stakx - I just noticed your comments above. I didn't see the comments as I was formulating my answer. I am leaving it here anyway. Commented Feb 15, 2012 at 18:06
  • Actually, a shapefile is one plausible way in which such values might occur. With a shapefile, numbers are maintained in base-10 ASCII character format, not as binary floats or doubles. If the stored value converts to an infinity or NaN, how will ArcGIS interpret it? Probably at the whim of whoever coded the shapefile reader (which means the ArcGIS behavior could change at any time, varying with the version, the release, and the bug fix currently in effect :-).
    – whuber
    Commented Feb 15, 2012 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.