Find Documents By Location with paging

0 votes
I think would be a very useful api call to have. i current have an app with a list of geo referenced images and sort them by location with many images at a single location, I don't want them all at once as it makes the loading of the app really slow as they are all downloaded at once, i would like to show say five and then make a call for the next 5 etc
asked Sep 18, 2016 in Discuss & suggest API by aaron Hatchard (11 points)

1 Answer

0 votes
Hi Aaron,
Please find below code snippet for the same and let me know if you required any other help from our side:
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
GeoTag gp = new GeoTag();
GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42Log.SetDebug(true); //Print output in your editor console
StorageService storageService = App42API.BuildStorageService(); 
storageService.SetPageOffset(0);  // Based on page index, change the value offset value 
storageService.FindDocumentsByLocation(dbName, collectionName, query, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
public void OnSuccess(object response)
Storage storage = (Storage) response;
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
public void OnException(Exception e)
App42Log.Console("Exception : " + e);
Himanshu Sharma
answered Sep 20, 2016 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on