I basically want to load some raster data (from GeoTIFF file) and then transform it via a Raster Function.
I created the Raster Function Template in ArcGISPro and then exported it in JSON format.
(Actually exported as XML and then converted to JSON via the Python console using arcpy.management.ConvertRasterFunctionTemplate as I found no way to directly export as JSON).
Now, in the code, when I want to create a RasterFunction instance from the JSON file I always get an Exception saying
Esri.ArcGISRuntime.ArcGISRuntimeException: JSON object key not found.
The documentation of the Runtime SDK (for any language) is vague at best.
When I look at a sample I noticed that the keys in the JSON use snake_case whereas the export from ArcGISPro uses camelCase (or PascalCase).
The sample I'm referring to:
I would be grateful for any hint on how to successfully load a Raster Function Template exported from ArcGISPro.
I attached the JSON file with the Raster Function.
I'm using ArcGIS Runtime 100.14.1 and ArcGISPro 3.0
I did some experiments based on the sample mentioned in the original post:
If I take the Raster Function from the sample as a JSON string and create a RasterFunction instance from that string, it works.
var rftJson = await File.ReadAllTextAsync(@"D:\temp\online_sample.rft.json"); var rasterFunction = RasterFunction.FromJson(rftJson);
If I instead try to create the RasterFunction instance directly from the file, it fails.
var rasterFunction = new RasterFunction(@"D:\temp\online_sample.rft.json");
Only this time with a different exception:
System.ArgumentException: Invalid argument: Failed to read 599 bytes from D:\temp\online_sample.rft.json
I attached the json file I used but with extension .txt as attatching files with .json extension wasn't possible.