How to query a raster (ImageServer) with iOS SDK?

824
3
Jump to solution
07-19-2021 10:25 AM
JuanPeralta_ESRIES
New Contributor II

Hi all,

I cannot find in the iOS SDK the way to query a ImageServer (Raster) layer to find the images meeting some specific criteria (spatial + attribute filter). I am trying to find the Sentinel2 images at a location for a date range, which in the REST API can be done here:

https://sentinel.arcgis.com/arcgis/rest/services/Sentinel2/ImageServer/query

Any tip?

Thanks!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DiveshGoyal
Esri Regular Contributor

Unfortunately, we don't yet support querying ImageServices. It is something we'd like to add, but we haven't gotten around to. For now, you'll have to invoke the REST API directly to get the result you want. We provide helper classes that can help with that. See AGSJSONRequestOperation . It will handle all the networking and authentication for you. You simply need to initialize it with the parameters, register a listener with a completion block, add it to an AGSOperationQueue . The completion block will be invoked with the result JSON.

Can you tell us a bit more about what you're building and why you need the query functionality. That'll help us prioritize the work. Feel free to direct message me.

View solution in original post

0 Kudos
3 Replies
DiveshGoyal
Esri Regular Contributor

Unfortunately, we don't yet support querying ImageServices. It is something we'd like to add, but we haven't gotten around to. For now, you'll have to invoke the REST API directly to get the result you want. We provide helper classes that can help with that. See AGSJSONRequestOperation . It will handle all the networking and authentication for you. You simply need to initialize it with the parameters, register a listener with a completion block, add it to an AGSOperationQueue . The completion block will be invoked with the result JSON.

Can you tell us a bit more about what you're building and why you need the query functionality. That'll help us prioritize the work. Feel free to direct message me.

0 Kudos
JuanPeralta_ESRIES
New Contributor II

Thanks for the answer @DiveshGoyal 

I am working on a mobile app (prototype for marketing purposes) for Precision Agriculture: monitoring crop evolution with Sentinel2 imagery, which is something quite common in the sector. At some selected points the app must query the Sentinel2 raster catalog to find all available rasters for a certain date range (acquisition date). Then, the app gets the pixel value from each available raster.

As I said, that is quite common, I can point out dozens of apps with that workflow implemented, or just look for "Precision Agriculture" or "AgTech" + iOS.

I will try with the REST API, but it would be nice to have it in the iOS SDK.

0 Kudos
JuanPeralta_ESRIES
New Contributor II

Coming back from my summer break... I tested your solution and it is working fine, so thanks again @DiveshGoyal .

By the way, for all of you looking for some tips about the implementation, I found an example with some Swift code to copy-paste:

https://gist.github.com/nixta/9db8be083b1823f1cbbe87db5cef6325

0 Kudos