Importing Raster Data

2195
12
05-12-2020 09:15 AM
MichaelGibson2
New Contributor II

I am surprised to find that ArcGIS runtime only supports a very limited set of raster formats: Add raster data—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Supported raster formats

ArcGIS Runtime supports a subset of raster file formats that ArcGIS Desktop supports. The raster file formats ArcGIS Runtime supports include the following:

  • ASRP/USRP
  • CRF
  • DTED0, 1, 2
  • GeoTIFF
  • HFA
  • HRE
  • IMG
  • JPEG
  • JPEG 2000
  • MrSID, generations 2, 3, and 4
  • NITF
  • PNG
  • RPF (CIB)
  • RPF (CADRG)
  • SRTM1, 2
  • Mobile mosaic datasets

I'm trying to import an ASCII grid format Esri ASCII raster format—Help | Documentation 

Which is basically an ascii text file, which looks like:

NCOLS xxx NROWS xxx XLLCENTER xxx YLLCENTER xxx CELLSIZE xxx NODATA_VALUE xxx row 1 row 2 ... row n

Having a brief look around, I find only a few threads of help. :Importing ASCII raster files 

Hi,

 

In the current v10.2.X release we don't have a specific raster data type or layer to handle these, you'll need to use the Local Server and a Geoprocessing Package to convert the ASCII raster into another raster format and then use the result map service to render that. In the upcoming v100.0 release we have added a raster layer which can reference raster files on disk. Here's the list of supported types: Add raster data—ArcGIS Runtime SDK for .NET (Quartz Beta) | ArcGIS for Developers.

 

If your app regularly has data coming in in ASCII format then you can still use the LocalServer to convert to one of the supported types above.

 

For more info on the Local Server see Work with local services—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Which I'm a bit confused about... It is not possible to process a conversion in memory, or is the only way currently to convert the file and open the new converted file, as this would seem terribly inefficient. 

Is there no way to create a raster object and pass it the memory, and use something else to actually load these files?

many thanks

Mike

0 Kudos
12 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Here's a sample on adding a raster dataset to a Local Map Service: arcgis-runtime-samples-dotnet/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Local Server/DynamicWorkspace... 

We have actually just removed that sample from the master branch because it's typically not the recommended workflow today (since Runtime natively supports reading raster data). But Local Server is still a valid workflow when the Runtime doesn't support the format you need. 

You could try combining that approach with TimeExtent: arcgis-runtime-samples-dotnet/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/MapView/ChangeTimeExtent at m... 

Thanks

Mike

0 Kudos
RobBever
New Contributor III

I haven't tried it yet, but it looks like using generic raster images where you have corner data from some other source (not embedded) is doable now (in SceneView only). If you look here:

 

Add image overlays—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

 

You can see that in 100.8.0 there's now ImageFrame, which takes a RuntimeImage and either an Envelope or a Polygon. So you can load your regular (non-georeferenced) image into a RuntimeImage and then put that in an ImageFrame with whatever corners you want, either as an Envelope rectangle or even a 4-point polygon. Then you can put that in an ImageOverlay and you should be all set.

 

I think you'd have to write your own translator from world file (or whatever source of corner data for your image) to Envelope or set of points, but I think that's a fairly standard conversion. But you should now be able to load your image with world file.

 

I want to do it too, and I haven't tried it yet, so let me know if it works.

0 Kudos
MichaelGibson2
New Contributor II

It would appear that my work around using GDAL to convert the ASCII grid into a geoTiff has stopped working...
Upon closer inspection it appear that 100.8 stopped reading the spatial reference (projection) of my converted geoTiff. At this point I don't know if its GDAL or ArcGis Runtime, but I didn't expect either to change without updating the version.

 

I wonder if there are any updates in this area?

0 Kudos