Cant add raster image to map

793
4
12-30-2017 04:37 PM
BernardoArevalo
New Contributor II

I'm having trouble placing a raster image onto a map in 100.2 iOS sdk.

This is what I'm currently doing, I make a call to 

 

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Image/02r3000000wm000000/

 

to download a tif file. I store the extent in the result to construct a world file using the algorithm provided here
raster - How to get values to create world file format? - Geographic Information Systems Stack Excha... .

 

Afterwards given the tif file and constructed tfw file, I download them to the apps documents library. I then try and load the ads raster with the given constructor

 

let raster = AGSRaster.init(name: extension: )

 

I then load the raster however when I check the extent, the spatial reference id, extent values, and center point are all wrong regardless of what I set in the tfw.

 

How do people go about adding images to maps??

I reviewed https://github.com/Esri/arcgis-runtime-samples-ios/tree/master/arcgis-ios-sdk-samples/Layers/Raster%...

and noticed that where the Shasta file is included an accompanying aux.xml and .tfw are there. I tried these files in my project to see if they worked, they did. I then tried to load this sample raster with just the tfw which still worked. I know then the problem is in the generation of the tfw, but this image is being generated from a service not arcgis pro, so I need a new way to be able to generate the tfw file

Does anyone have any suggestions?

0 Kudos
4 Replies
BernardoArevalo
New Contributor II

Well, to answer my own question.

I ended up realizing that the information that the ios sdk uses isnt in the tfw file and aux.xml file but in the tiff image itself. After looking into ways to place this info ( spatial reference and extent ) into the tiff, I settled on using GDAL gdal_transform with gdalwrap to accomplish this.

The flow was

Call exportImage image service (which returns SR and extent) => create api that calls shell to process a file embedding the SR and extent into file (return an id to of file) => use alamofire to download the tiff file to the documents library

what up.   

0 Kudos
MichaelDavis3
Occasional Contributor III

Interesting solution - I'm curious why you are trying to download individual image tiles directly rather than just loading up a rasterLayer and handing it a portal or AGS item?

0 Kudos
MarkDostal
Esri Contributor

Bernardo,

I'm glad you found a solution that works for you.

The iOS Runtime SDK *does* use the information the supporting files when rendering the raster.  To test that, I removed all but the "Shasta.tif" file from the samples project and re-build/re-ran the app.  The Shasta tif did *not* show up for me without those files.

You said you were using the "exportImage" endpoint on the image service.  Take a look at the "Download Raster" endpoint here.  It creates and provides links to the supporting files.  However, the image service must support the "download" operation, which not all do.

Hope that helps and if you have any more questions, let us know.

Thanks,

Mark

0 Kudos
BernardoArevalo
New Contributor II

I did consider using that endpoint of DownloadRaster however the image service I was using did not provide the function. When I tried to call it the service literally returned that it was not available for the given service.

0 Kudos