How can i load a locally stored geo tiff?

5360
9
06-13-2012 06:30 AM
Labels (1)
RonSchwartz
New Contributor
Hey there,
I am trying to load a layer with a locally stored geo tiff.
What kind of object layer do i need to use? Do ArcGISImageServiceLayer works only with service stored layers? ArcGISTiledMapServiceLayer doesn't work with that kind of input.
Thanks,

Ron
0 Kudos
9 Replies
AlexanderMagnusson
New Contributor
Hello Ron

ArcGIS Runtime cannot directly read GeoTIFFs. It can't almost ready any "raw" data format actually. Data is primarily "delivered" in package files (.mpk/.tpk) so you could use ArcGIS Desktop 10.1 to create such a package containing the data you want.

There are two other workarounds too, it can use a WMS service and read KML files. You could deliver your geotiffs through either a wms service or as (I assume) a GroundOverlay in a kml file.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

As Alexander nicely outlined, the workflow for getting data into apps built with the ArcGIS Runtime SDK for WPF if to create packages (Map, Tile, Locator, Geoprocessing) with ArcGIS for Desktop and use those as the basis for local services. There are a couple of other approaches which you can take. The first is to use the dynamic layers capability in conjunction with a local map service, which allows you to dynamically add/remove layers from the local map service. Or alternatively create a GP tool which takes a raster as input and simply outputs the same raster, package it and then start a local geoprocessing service of type SubmitJobWithMapServerResult and add the map service result as a layer to you map control.

Cheers

Mike
0 Kudos
MiriRevivo
Occasional Contributor
Hi Mike,

We are trying to help our customer (that asked the initial question in this post) to implement your suggestion above.
The package I've built contains a model that receives a raster as input, runs a CopyRaster operation upon it and returns the result as a model parameter. I couldn't get this model to run no matter what I've tried.
I then found this post, that states that Runtime SDKs do not support rasters as input data to GP tools.
http://forums.arcgis.com/threads/41247-Error-when-executing-a-geoprocessor.
However, that was a long time ago, and I'm wondering if this is still the case?

The error I'm getting varies between: "Unable to complete operation" to "Dont know how to write special parameter 'InputRaster' of type 'JSON Object' with value 'C:\\Miri\\Data\\Elevation\\RIT_DEM\\10m\\miri.img'", depending on how I'm running the tool (either from code or from the browser, after initiating the local service in code).

Thanks!
Miri.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi Miri,

The input should be a String (GPString) which represents the path to the raster file. However, the GP approach is a heavier weight option than the dynamic layers approach because it will create 3 processes. I'm just working on an example of each and will post when finished.

Cheers

Mike
0 Kudos
MiriRevivo
Occasional Contributor
Hi Mike,

Thank you for the prompt reply!

The dynamic layers approach is the first one we've tried here, but unfortunately it didn't work with rasters, and Esri's Support have logged a bug report about it - NIM082446.
After that we've tried the GP tool approach, I've tried sending the parameters as GPRasterData, as GPString and also as GPFileData, none of them worked.

Also when I try to run the service from HTML (from the browser)- it fails with the following error -
"Dont know how to write special parameter 'InputRaster' of type 'JSON Object' with value 'C:\\Miri\\Data\\Elevation\\RIT_DEM\\10m\\miri.img'". This led me to think that the problem is what I wrote in my previous post - that raster data is not supported as input to GP tools in the Runtime SDKs (the model I've built receives a RasterDataset input parameter and also returns a parameter of the same type).

Thanks!
Miri.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

I've attached an example app and GPK to this thread - the code's pretty rough but hopefully it demonstrates how I believe you can achieve your goal with this approach.

I'll investigate the dynamic layers raster issue you reported.

Cheers

Mike
0 Kudos
MiriRevivo
Occasional Contributor
Mike,

Thanks a lot for the effort! I appreciate it.
I've tried it and it indeed does the trick.
I now see the difference - my code is the same as yours, but my model receives the raster as a RasterDataset parameter type rather than a path (because I've been using the Copy Raster tool and not the Calculate Value tool).

Thanks again!
Miri.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi Miri,

I've just uploaded a dynamic layers sample to ArcGIS Online: http://www.arcgis.com/home/item.html?id=953a530ada30477d95cc69e788268bc9.

This demonstrates adding Shapefiles and raster datasets to the map - I believe you said you were experiencing problems with rasters? If so, I hope this sample will help you resolve the issue.

Cheers

Mike
0 Kudos
MiriRevivo
Occasional Contributor
Hi Mike,

Thanks for the link to the sample. We've tested it and it does solve our problems.
I will check the differences between what you did and what the guy who tested it here at Systematics did, to see where we went wrong.

Regarding the other manner we've discussed - adding the raster from a GP service ran using the SubmitJobWithMapServerResult - when we're adding single band rasters - they are displayed ok, but 3 band rasters are rendered in grayscale as well when added in the same manner. I've thought about changing the layer's renderer but I'm not sure how to do it in Runtime with raster layers.
Another problem we've ran into is that the GPResultImageLayer doesn't have an extent or a spatial reference associated to it, although the original raster has them. I've tried to set the OutputSpatialReference of the Geoprocessor before running the task, but it didn't help.
Is the GPResultImageLayer configurable in any way (in the aspects I've mentioned)?

Thanks,
Miri.
0 Kudos