Importing Raster Data

1256
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,

The answer might depend on your workflow, or that of your users e.g. Is this a one-time import of raster data into another format or do users of your app regularly open ascii rasters from disk?

If you're building an app with WPF then you could use the ArcGIS Runtime Local Server. This will support all the raster formats of ArcGIS Pro / ArcMap. You could read/render the dataset from disk via a LocalMapService or use a LocalGeoprocessingService to import/convert the raster data between formats.

Thanks

Mike

MichaelGibson2
New Contributor II

Thanks for your reply.

I think there will be two main questions/uses I'm thinking of: the first being that we will often need to load the ASCII formats, and the second I'm considering an animation by showing a number of raster one after another, for which I have the data in memory, and again it would seem fairly inefficient to send it to the disk only to be reloaded.

I'm currently using an encapsulated WPF form within my .NET windows forms app; which intend to migrate up to WPF at some point soon. Having a bit of look around ArcGIS Runtime Local Servers, and LacalMapServices, and LocalGepprocessingServices doesn't look too simple; Could you give a quick example for the purpose of 1. loading an ASCII file 2. passing data?

Many Thanks

Mike

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Are you using the 2D MapView or 3D SceneView? 

Thanks

MichaelGibson2
New Contributor II

2D initially, although its certainly interesting to consider the 3D options.

many thanks

0 Kudos
MichaelGibson2
New Contributor II

So I found a work around for the time being, whereby for loading the ASCII, I'll just use GDAL to convert it to a GeoTiff format. Although this seems terribly inefficient.

For the animation, that would be even more inefficient it would seem.

I had a quick look at the LocalServer and LocalMapService, but this would seem you need to have users install and run the separate program that is the LocalServer? Is this correct?
Is no way to pass it the data, if I've already loaded them with something else like GDAL, or lets say generated them?

many thanks

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

The latest release (100.8) added support for 'animation' of raster data in the 3D scene view with Image Overlays. Bringing that to the 2D map view is on the roadmap for a future release.

Regarding Local Server, that's an additional component/SDK that you as the developer install on your dev machine and incorporate the capabilities into your app then you include the Local Server pieces you need when you deploy the app to your users

How many raster datasets would you like to animate and what's the image size approx?

Thanks

Mike

MichaelGibson2
New Contributor II

Thanks for your continued support Michael Branscomb

It would seem that 'animation' presumes you have all the images before the animation begins...

In actual fact, I have a flood modelling system, for which I'd like to show the outputs, and because of this I won't have the rasters until they are produced by the model.

Thanks for clarifying the localServer a bit more. Would the local server be able to load the the ASCII files into data and pass that to the map, which would be quicker and more effecient than converting them with GDAL.

I'm still trying to get the colours right in another post, but again because this will be model output, the size and number of rasters could vary. Although the number of rasters, would mainly depend on what the system can push through in a given time, thus my questions of the efficiency of loading/converting/passing data etc.

Cheers muchly

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

The Local Server component provides a wide range of functionality and a lot of flexibility through geoprocessing services that execute python scripts. But with that comes the overhead of hosting and executing the local service which may not be significant but does mean it's typically not as fast as executing functionality that is entirely within the API / client-side (good examples being the visual analysis and image overlays which are highly optimized API-level features). 

Local Server may be an option for you though - it broadly supports the same range of raster formats as ArcGIS Pro (because it's built from the same codebase): Raster file formats—ArcGIS Pro | Documentation.

Do the raster datasets have a time aspect to them? 

Thank

Mike

0 Kudos
MichaelGibson2
New Contributor II

Thanks again Michael Branscomb

Yes the rasters do have a time element, as its a flood scenario. Although at present I'm mainly worrying about creating the animation through a series of time slice rasters.

So can the LocalServer (or maybe LocalMapService) pass the data to the map for the purposes of such an animation?

I don't supposed you could provide some code snippets to do this relatively simple procedure?

I guess I'll need at how to implement the local server/local map service to do this.

cheers

0 Kudos