Hi I was just diving into the new Spatial Analysis tools added in 300.0 since I use raster data extensively in my line of work. I was doing some initial test to try and learn how to use the new map algebra functions and ran into a few issues. The only sample I could find was this Apply map algebra | ArcGIS Maps SDK for .NET | Esri Developer, if there are more samples I could look over, please let me know!
Here are some issues/questions I've had so far:
1. I created a ContinuousFieldFunction with a few filters on it. I can export the results to file and load those files as rasters and that all works fine. I was wondering if I could apply the field function to an existing raster layer without needing to write the data to disk first?
I was trying to find the sample from the gif on the Spatial Anaylsis page (Spatial analysis | ArcGIS Maps SDK for .NET | Esri Developer) since it states it uses map algebra operations to create the gif and im assuming each of those 'frames' is not individual raster files on disk?
2. I was trying to apply class breaks renderer to my raster. So, I have a List<ClassBreak> with each break having a color and upper value range. The idea was to reclassify the raster so that instead of floats id have int values for each break. I then apply a ColormapRenderer with the colors associated to each class break's index.
I was trying something like this initially:
ContinuousField field = await ContinuousField.CreateAsync([path], 0);
ContinuousFiledFunction contFieldFunc = ContinuousFieldFunction.Create(field);
DiscreteFieldFunction discFunc = contFieldFunc.ToDiscreteFieldFunction();
for (int i = 0; i < classBreaks.Count; i++)
{
BooleanFieldFunction boolFunc = contFieldFunc.IsLessThanOrEqualTo(classBreaks[i].Value);
discFunc = discFunc.ReplaceIf(boolFunc, i);
}
DicreteField classBreaksField = await discFunc.EvaluateAsync(); But I couldn't get it to work. It would only keep my last bool function. I also tried inverting the order of my class breaks so that something like "IsLessThanOrEqualTo(100)" wouldn't 'cover up' "IsLessThanOrEqualTo(50)", as an example. But neither worked.
I could, however, get it working if I did all the functions in a single line like:
discFunc.ReplaceIf(boolFunc0, 0).ReplaceIf(boolFunc1, 1).ReplaceIf(boolFunc2, 2)... etc
But I can't build out this single-line expression when the user specifies how many class breaks they want. Is it possible to chain functions together inside a loop?
3. DiscreteField & BooleanField classes state they support all raster pixel types except float (32-bit or 64-bit) up to 2147483647. I just want to clarify that this covers both signed and unsigned integers?
4. Similar to #3, ContinuousField seems to only support 32-bit float rasters? My initial test was on a 64-bit float raster, and it threw an exception. I converted to 32-bit, and it worked. I'm just seeking clarification on the supported types for these two fields.