This module offers a complete set of APIs for Geo Spatial Service on cloud including storage, retrieval, query and updation of geographical data. You can store geographical data with unique handler on the cloud and also search, update and query on the same. Geo spatial query includes locating nearby/in-circle target points from given location using geo points stored on the cloud.
In order to use various functions available in a specific API, a developer has to create an instance of ServiceAPI by passing the apiKey and secretKey which will be created after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"<API_KEY>"; api.secretKey = @"<SECRET_KEY>";ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");Coming SoonApp42.initialize("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");$api = new ServiceAPI("API_KEY","SECRET_KEY");Coming Soonapi = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>")Coming SoonComing Soon
After initialization, developer needs to call the buildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of GeoService, buildGeoService() method needs to be called.
GeoService geoService = api.buildGeoService();GeoService geoService = api.BuildGeoService();GeoService *geoService = [api buildGeoService];GeoService geoService = api.buildGeoService();GeoService geoService = api.buildGeoService();Coming Soonvar geoService = new App42Geo();GeoService geoService = api.BuildGeoService();$geoService = $api->buildGeoService();Coming Soongeo_service = api.build_geo_service()Coming SoonComing Soon
import com.shephertz.app42.paas.sdk.android.ServiceAPI; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.geo.Geo; import com.shephertz.app42.paas.sdk.android.geo.GeoService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.geo;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"import com.shephertz.app42.paas.sdk.jme.ServiceAPI; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.geo.Geo; import com.shephertz.app42.paas.sdk.jme.geo.GeoService;import com.shephertz.app42.paas.sdk.java.ServiceAPI; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.geo.Geo; import com.shephertz.app42.paas.sdk.java.geo.GeoService;Coming Soon<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.geo;use com\shephertz\app42\paas\sdk\php\App42Response; use com\shephertz\app42\paas\sdk\php\App42Exception; use com\shephertz\app42\paas\sdk\php\App42BadParameterException; use com\shephertz\app42\paas\sdk\php\App42NotFoundException; use com\shephertz\app42\paas\sdk\php\geo\GeoService; use com\shephertz\app42\paas\sdk\php\ServiceAPI; include_once '../GeoService.php'; include_once '../ServiceAPI.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';Coming Soonrequire 'App42_Ruby_API'Coming SoonComing Soon
Stores the geo points with unique handler on the cloud. Geo point data contains lat, long and marker of the point.
Required Parameters
storageName - Unique handler for storage name.
geoPointsList - List of Geo Points to be saved.
String storageName = "storageName"; ArrayList<GeoPoint> geoList = new ArrayList<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat(new BigDecimal(-74.2713)); gp.setLng(new BigDecimal(40.73137)); geoList.add(gp); Geo geo = geoService.createGeoPoints(storageName,geoList); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();public class Callback : App42Callback { String storageName = "storageName"; IList<GeoPoint> geoList = new List<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.SetMarker("Maplewood, NJ"); gp.SetLat(-74.2713); gp.SetLng(40.73137); geoList.Add(gp); geoService.CreateGeoPoints(storageName,geoList,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Geo geo = (Geo) response; Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString(); } }NSString *storageName = @"geoTest"; NSMutableArray *geoList = [[NSMutableArray alloc]init]; GeoPoint *gp = [[GeoPoint alloc]init]; gp.marker = @"Maplewood,NJ"; gp.latitude = -74.2713; gp.longitude = 40.73137; [geoList addObject:gp]; Geo *geo = [geoService createGeoPoints:storageName geoPointsList:geoList]; NSLog(@"storageName is ", geo.storageName); NSString *jsonResponse = [geo toString];String storageName = "storageName"; Vector geoList = new Vector(); GeoPoint gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat(new Double(-74.2713)); gp.setLng(new Double(40.73137)); geoList.addElement(gp); Geo geo = geoService.createGeoPoints(storageName,geoList); System.out.println("storageName is " + geo.getStorageName(); String jsonResponse = geo.toString();String storageName = "storageName"; ArrayList<GeoPoint> geoList = new ArrayList<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat(new BigDecimal(-74.2713)); gp.setLng(new BigDecimal(40.73137)); geoList.add(gp); Geo geo = geoService.createGeoPoints(storageName,geoList); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming Soonvar geoList = new Array(); var point = { lat:-74.2713, lng:40.73137, marker: "Maplewood, NJ" }; geoList.push(point); var storageName = "storageName", result ; geoService.createGeoPoints(storageName,geoList,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo.storage; console.log("result is " + result.storageName) }, error: function(error) { } });String storageName = "storageName"; IList<GeoPoint> geoList = new List<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.SetMarker("Maplewood, NJ"); gp.SetLat(-74.2713); gp.SetLng(40.73137); geoList.Add(gp); Geo geo = geoService.CreateGeoPoints(geoStorageName,geoList); Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString();$storageName = "storageName"; $geoList = array(); $gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat((-74.2713); gp.setLng(40.73137); geoList.add(gp); $geo = $geoService->createGeoPoints($storageName,$geoList); print_r("storageName is " . $geo->getStorageName()); $jsonResponse = $geo->toString();Coming Soongeo_storage_name = "geoTest"; geo_points_list = Array.new(); gp = App42::Geo::GeoPoint.new(); gp.lat = "-74.2713"; gp.lng = "40.73137"; gp.marker = "Maplewood, NJ"; geo_points_list.push(gp); geo = geo_service.create_geo_points(geo_storage_name, geo_points_list); puts "storageName is #{geo.get_storage_name}"; point_list = Array.new(); point_list = geo.point_list(); for point in point_list do puts "lat is #{point.lat}"; puts "lng is #{point.lng}"; puts "marker is #{point.marker}"; end json_response = geo.to_s();Coming SoonComing Soon
Get All Point from storage.
Required Parameters
storageName - Name of the storage from which ponits have to be fetched.
String storageName = "storageName"; Geo geo = geoService.getAllPoints(storageName); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();public class Callback : App42Callback { String storageName = "storageName"; geoService.GetAllPoints(geoStorageName,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Geo geo = (Geo) response; Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString(); } }NSString *storageName = @"geoTest"; Geo *geo = [geoService getAllPoints:storageName]; NSLog(@"storageName is ", geo.storageName); NSString *jsonResponse = [geo toString];String storageName = "storageName"; Geo geo = geoService.getAllPoints(storageName); System.out.println("storageName is " + geo.getStorageName(); String jsonResponse = geo.toString();String storageName = "storageName"; Geo geo = geoService.getAllPoints(storageName); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming Soonvar storageName = "storageName", result ; geoService.getAllPoints(storageName,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo.storage; console.log("result is " + result.storageName) }, error: function(error) { } });String storageName = "storageName"; Geo geo = geoService.GetAllPoints(storageName); Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString();$storageName = "storageName"; $geo = $geoService->getAllPoints($storageName); print_r("storageName is " . $geo->getStorageName()); $jsonResponse = $geo->toString();Coming Soonstorage_name = "geoTest"; geo = geo_service.get_all_points(storage_name); puts "storageName is #{geo.get_storage_name}"; point_list = Array.new(); point_list = geo.point_list(); for point in point_list do puts "lat is #{point.lat}"; puts "lng is #{point.lng}"; puts "marker is #{point.marker}"; end json_response = geo.to_s();Coming SoonComing Soon
Get All Point from storage.
Required Parameters
storageName - Name of the storage from which ponits have to be fetched.
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
String storageName = "storageName"; int max = 1; int offset = 0; Geo geo = geoService.getAllPoints(storageName,max,offset); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming SoonComing SoonComing SoonString storageName = "storageName"; Geo geo = geoService.getAllPoints(storageName,max,offset); int max = 1; int offset = 0; System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming SoonComing SoonString storageName = "storageName"; int max = 1; int offset = 0; Geo geo = geoService.GetAllPoints(storageName,max,offset); Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString();$storageName = "storageName"; max = 1; offset = 0; $geo = $geoService->getAllPoints($storageName,$max,$offset); print_r("storageName is " . $geo->getStorageName()); $jsonResponse = $geo->toString();Coming SoonComing SoonComing SoonComing Soon
Fetch the name of all storage stored on the cloud.
ArrayList<Geo> geo = geoService.getAllStorage(); System.out.println("storageName is " + geo.get(0).getStorageName()); System.out.println("createdOn is " + geo.get(0).getCreatedOn()); String jsonResponse = geo.get(0).toString();public class Callback : App42Callback { geoService.GetAllStorage(this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { IList<Geo> geo = (IList<Geo>) response; Console.WriteLine("storageName is " + geo[0].GetStorageName()); Console.WriteLine("createdOn is " + geo[0].GetCreatedOn()); String jsonResponse = geo[0].ToString(); } }NSArray *geo = [geoService getAllStorage]; NSLog(@"storageName is %@" , [[geo objectAtIndex:0] storageName]); NSLog(@"emailId is %@" , [[geo objectAtIndex:0] createdOn]); NSString *jsonResponse =[[geo objectAtIndex:0] toString];Vector geo = geoService.getAllStorage(); System.out.println("storageName is " + ((Geo)geo.elementAt(0)).getStorageName()); System.out.println("createdOn is " + ((Geo)geo.elementAt(0)).getCreatedOn()); String jsonResponse = ((Geo)geo.elementAt(0)).toString();ArrayList<Geo> geo = geoService.getAllStorage(); System.out.println("storageName is " + geo.get(0).getStorageName()); System.out.println("createdOn is " + geo.get(0).getCreatedOn()); String jsonResponse = geo.get(0).toString();Coming Soonvar result ; geoService.getAllStorage({ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo; console.log("result is " + result) }, error: function(error) { } });IList<User> geo = geoService.GetAllStorage(); Console.WriteLine("storageName is " + geo[0].GetStorageName()); Console.WriteLine("createdOn is " + geo[0].GetCreatedOn()); String jsonResponse = geo[0].ToString();$geo = $geoService->getAllStorage(); print_r("storageName is " . $geo[0]->getStorageName()); print_r("createdOn is " . $geo[0]->getCreatedOn()); $jsonResponse = $geo[0]->toString();Coming Soongeo_list = Array.new(); geo_list = geo_service.get_all_storage(); for geo in geo_list do puts "storageName is #{geo.get_storageName}"; end json_response = geo_list.to_s();Coming SoonComing Soon
Fetch the name of all storage stored on the cloud by paging.
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
int max = 1; int offset = 0; ArrayList<Geo> geo = geoService.getAllStorageByPaging(max,offset); System.out.println("storageName is " + geo.get(0).getStorageName()); System.out.println("createdOn is " + geo.get(0).getCreatedOn()); String jsonResponse = geo.get(0).toString();Coming SoonComing SoonComing Soonint max = 1; int offset = 0; ArrayList<Geo> geo = geoService.getAllStorageByPaging(max,offset); System.out.println("storageName is " + geo.get(0).getStorageName()); System.out.println("createdOn is " + geo.get(0).getCreatedOn()); String jsonResponse = geo.get(0).toString();Coming Soonvar max = 1, offset = 0, result ; geoService.getAllStorageByPaging(max,offset,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo; console.log("result is " + result) }, error: function(error) { } });int max = 1; int offset = 0; IList<User> geo = geoService.GetAllStorageByPaging(max,offset); Console.WriteLine("storageName is " + geo[0].GetStorageName()); Console.WriteLine("createdOn is " + geo[0].GetCreatedOn()); String jsonResponse = geo[0].ToString();$max = 1; $offset = 0; $geo = $geoService->getAllStorageByPaging($max,$offset); print_r("storageName is " . $geo[0]->getStorageName()); print_r("createdOn is " . $geo[0]->getCreatedOn()); $jsonResponse = $geo[0]->toString();Coming SoonComing SoonComing SoonComing Soon
Search the near by point from specified source point. Points to be searched should already be stored on cloud using unique storage name handler.
Required Parameters
storageName - Unique handler for storage name.
lat - Lattitude of source point.
lng - Longitude of source point.
resultLimit - Maximum number of results to be retrieved.
String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); int resultLimit = 2; Geo geo = geoService.getNearByPoint(storageName,lat,lng,resultLimit); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();public class Callback : App42Callback { String storageName = "storageName"; Double lat = -73.99171; Double lng = 40.738868; int resultLimit = 2; geoService.GetNearByPoint(storageName,lat,lng,resultLimit,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Geo geo = (Geo) response; Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString(); } }NSString *storageName = @"geoTest"; double lat = -73.99171; double lng = 40.738868; int resultLimit = 2; Geo *geo = [geoService getNearByPoint:storageName latitude:lat longitude:lng resultLimit:resultLimit]; NSLog(@"storageName is ", geo.storageName); NSString *jsonResponse = [geo toString];String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); int resultLimit = 2; Geo geo = geoService.getNearByPoint(storageName,lat,lng,resultLimit); System.out.println("storageName is " + geo.getStorageName(); String jsonResponse = geo.toString();String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); int resultLimit = 2; Geo geo = geoService.getNearByPoint(storageName,lat,lng,resultLimit); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming Soonvar storageName = "storageName", lat = -73.99171, lng = 40.738868, resultLimit = 2, result ; geoService.getNearByPoint(storageName,lat,lng,resultLimit,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo.storage; console.log("result is " + result.storageName) }, error: function(error) { } });String storageName = "storageName"; Double lat = -73.99171; Double lng = 40.738868; int resultLimit = 2; Geo geo = geoService.GetNearByPoint(geoStorageName,lat,lng,resultLimit); Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString();$storageName = "storageName"; $lat = -73.99171; $lng = 40.738868; $resultLimit = 2; $geo = $geoService->getNearByPoint($storageName,$lat,$lng,$resultLimit); print_r("storageName is " . $geo->getStorageName()); $jsonResponse = $geo->toString();Coming Soonstorage_name = "geoTest"; lat = "-73.99171"; lng = "40.738868"; result_limit = "2"; geo = geo_service.get_near_by_point(storage_name, lat, lng, result_limit); puts "storageName is #{geo.get_storage_name}"; puts "sourceLat is #{geo.source_lat}"; puts "distanceInKM is #{geo.distanceInKM}"; puts "sourceLng is #{geo.sourceLng}"; point_list = Array.new(); point_list = geo.point_list(); for point in point_list do puts "lat is #{point.lat}"; puts "lng is #{point.lng}"; puts "marker is #{point.marker}"; end json_response = geo.to_s();Coming SoonComing Soon
Search the near by point from specified source point with in specified radius. Points to be searched should already be stored on cloud using unique storage name handler.
Required Parameters
storageName - Unique handler for storage name.
lat - Lattitude of source point.
lng - Longitude of source point.
radiusInKM - Radius in KM.
resultLimit - Maximum number of results to be retrieved.
String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal radiusInKM = new BigDecimal(1); int resultLimit = 2; Geo geo = geoService.getPointsWithInCircle(storageName,lat,lng,radiusInKM,resultLimit); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();public class Callback : App42Callback { String storageName = "storageName"; Double lat = -73.99171; Double lng = 40.738868; Double radiusInKM = 1; int resultLimit = 2; geoService.GetPointsWithInCircle(storageName,lat,lng,radiusInKM,resultLimit,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Geo geo = (Geo) response; Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString(); } }NSString *storageName = @"geoTest"; double lat = -73.99171; double lng = 40.738868; Double radiusInKM = 1; int resultLimit = 2; Geo *geo = [geoService getPointsWithInCircle:storageName latitude:lat longitude:lng radiusInKM:radiusInKM resultLimit:resultLimit]; NSLog(@"storageName is ", geo.storageName); NSString *jsonResponse = [geo toString];String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal radiusInKM = new BigDecimal(1); int resultLimit = 2; Geo geo = geoService.getPointsWithInCircle(storageName,lat,lng,radiusInKM,resultLimit); System.out.println("storageName is " + geo.getStorageName(); String jsonResponse = geo.toString();String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal radiusInKM = new BigDecimal(1); int resultLimit = 2; Geo geo = geoService.getPointsWithInCircle(storageName,lat,lng,radiusInKM,resultLimit); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming Soonvar storageName = "storageName", lat = -73.99171, lng = 40.738868, resultLimit = 2, radiusInKM = 1, result ; geoService.getPointsWithInCircle(storageName,lat,lng,radiusInKM,resultLimit,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo.storage; console.log("result is " + result.storageName) }, error: function(error) { } });String storageName = "storageName"; Double lat = -73.99171; Double lng = 40.738868; Double radiusInKM = 1; int resultLimit = 2; Geo geo = geoService.GetPointsWithInCircle(geoStorageName,lat,lng,radiusInKM,resultLimit); Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString();$storageName = "storageName"; $lat = -73.99171; $lng = 40.738868; $radiusInKM = 1; $resultLimit = 2; $geo = $geoService->getPointsWithInCircle($storageName,$lat,$lng,$radiusInKM,$resultLimit); print_r("storageName is " . $geo->getStorageName()); $jsonResponse = $geo->toString();Coming Soonstorage_name = "geoTest"; lat = "-73.99171"; lng = "40.738868"; radiusInKM = "1"; result_limit = 1; geo = geo_service.get_points_with_in_circle(storage_name, lat, lng, radiusInKM, result_limit); puts "storageName is #{geo.get_storage_name}"; puts "sourceLat is #{geo.sourceLat}"; puts "distanceInKM is #{geo.distanceInKM}"; puts "sourceLng is #{geo.sourceLng}"; point_list = Array.new(); point_list = geo.point_list(); for point in point_list do puts "lat is #{point.lat}"; puts "lng is #{point.lng}"; puts "marker is #{point.marker}"; end json_response = geo.to_s();Coming SoonComing Soon
Search the near by point in given range(In KM) from specified source point. Points to be searched should already be stored on cloud using unique storage name handler.
Required Parameters
storageName - Unique handler for storage name.
lat - Lattitude of source point.
lng - Longitude of source point.
distanceInKM - Range in KM.
String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal distanceInKM = new BigDecimal(1); Geo geo = geoService.getNearByPointsByMaxDistance(storageName,lat,lng,distanceInKM); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();public class Callback : App42Callback { String storageName = "storageName"; Double lat = -73.99171; Double lng = 40.738868; Double distanceInKM = 1; geoService.GetNearByPointsByMaxDistance(storageName,lat,lng,distanceInKM,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Geo geo = (Geo) response; Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString(); } }NSString *storageName = @"geoTest"; double lat = -73.99171; double lng = 40.738868; Double distanceInKM = 1; Geo *geo = [geoService getNearByPointsByMaxDistance:storageName latitude:lat longitude:lng distanceInKM:distanceInKM]; NSLog(@"storageName is ", geo.storageName); NSString *jsonResponse = [geo toString];String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal distanceInKM = new BigDecimal(1); Geo geo = geoService.getNearByPointsByMaxDistance(storageName,lat,lng,distanceInKM); System.out.println("storageName is " + geo.getStorageName(); String jsonResponse = geo.toString();String storageName = "geoTest"; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal distanceInKM = new BigDecimal(1); Geo geo = geoService.getNearByPointsByMaxDistance(storageName,lat,lng,distanceInKM); System.out.println("storageName is " + geo.getStorageName(); System.out.println("lat is " + geo.getPointList().get(0).getLat()); String jsonResponse = geo.toString();Coming Soonvar storageName = "storageName", lat = -73.99171, lng = 40.738868, distanceInKM = 1, result ; geoService.getNearByPointsByMaxDistance(storageName,lat,lng,distanceInKM,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response.geo.storage; console.log("result is " + result.storageName) }, error: function(error) { } });String storageName = "storageName"; Double lat = -73.99171; Double lng = 40.738868; Double distanceInKM = 1; Geo geo = geoService.GetNearByPointsByMaxDistance(geoStorageName,lat,lng,distanceInKM); Console.WriteLine("storageName is " + geo.GetStorageName()); Console.WriteLine("lat is " + geo.GetPointList()[0].GetLat()); String jsonResponse = geo.ToString();$storageName = "storageName"; $lat = -73.99171; $lng = 40.738868; $distanceInKM = 1; $geo = $geoService->getNearByPointsByMaxDistance($storageName,$lat,$lng,$distanceInKM); print_r("storageName is " . $geo->getStorageName()); $jsonResponse = $geo->toString();Coming Soonstorage_name = "geoTest"; lat = "-73.99171"; lng = "40.738868"; distanceInKM = "1"; geo = geo_service.get_near_by_points_by_max_distance(storage_name, lat, lng, distanceInKM); puts "storageName is #{geo.get_storage_name}"; puts "sourceLat is #{geo.sourceLat}"; puts "distanceInKM is #{geo.distanceInKM}"; puts "sourceLng is #{geo.sourceLng}"; point_list = Array.new(); point_list = geo.point_list(); for point in point_list do puts "lat is #{point.lat}"; puts "lng is #{point.lng}"; puts "marker is #{point.marker}"; end json_response = geo.to_s();Coming SoonComing Soon
Delete the specified Geo point from Cloud
Required Parameters
storageName - Name of storage from which geo point has to be deleted.
geoList - List of geo points that has to be deleted.
String storageName = "storageName"; ArrayList<GeoPoint> geoList = new ArrayList<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat(new BigDecimal(-74.2713)); gp.setLng(new BigDecimal(40.73137)); geoList.add(gp); App42Response response = geoService.deleteGeoPoints(storageName,geoList); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming SoonComing SoonComing SoonString storageName = "storageName"; ArrayList<GeoPoint> geoList = new ArrayList<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat(new BigDecimal(-74.2713)); gp.setLng(new BigDecimal(40.73137)); geoList.add(gp); App42Response response = geoService.deleteGeoPoints(storageName,geoList); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming Soonvar geoList = new Array(); var point = { lat:-73.99171, lng:40.738868, marker: "test1" }; geoList.push(point); var storageName = "storageName", result ; geoService.deleteGeoPoints(storageName,geoList,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response; console.log("result is " + result) }, error: function(error) { } });String storageName = "storageName"; IList<GeoPoint> geoList = new List<GeoPoint>(); GeoPoint gp = new GeoPoint(); gp.SetMarker("Maplewood, NJ"); gp.SetLat(-74.2713); gp.SetLng(40.73137); geoList.Add(gp); App42Response response = geoService.DeleteGeoPoints(storageName,geoList); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$storageName = "storageName"; $geoList = array(); $gp = new GeoPoint(); gp.setMarker("Maplewood, NJ"); gp.setLat((-74.2713); gp.setLng(40.73137); geoList.add(gp); $response = $geoService->deleteGeoPoints($storageName,$geoList); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing SoonComing SoonComing Soon
Delete the specified Geo Storage from Cloud
Required Parameters
storageName - Name of storage which has to be deleted.
String storageName = "storageName"; App42Response response = geoService.deleteStorage(storageName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String storageName = "storageName"; geoService.deleteStorage(storageName,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response geo = (App42Response) response; String jsonResponse = geo.ToString(); } }NSString *storageName = @"storageName"; App42Response *response = [geoService deleteStorage:storageName]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String storageName = "storageName"; App42Response response = geoService.deleteStorage(storageName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String storageName = "storageName"; App42Response response = geoService.deleteStorage(storageName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming Soonvar storageName = "storageName", result ; geoService.deleteStorage(storageName,{ success: function(object) { var geoObj = JSON.parse(object); result = geoObj.app42.response; console.log("result is " + result) }, error: function(error) { } });String storageName = "storageName"; App42Response response = geoService.DeleteStorage(storageName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$storageName = "storageName"; $response = $geoService->deleteStorage($storageName); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming Soonstorage_name = "geoTest"; response = geo_service.delete_storage(storage_name); success = response.is_response_success(); json_response = geo.to_s();Coming SoonComing Soon
The functions available under Geo Spatial API can throw some exceptions in abnormal conditions. Example of the same has been given below. E.g. If App developer is trying to delete the storage that does not exist, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “2903” and the details as “No Geo Storage exists with name ‘@storageName’“.
String storageName = "storageName"; try { App42Response response = geoService.deleteStorage(storageName); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }public class Callback : App42Callback { String queueName = "MyQueue"; String msg = "Its a Real Message"; long exp = 100000; queueService.SendMessage(queueName, msg, exp, this); void App42Callback.OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } void App42Callback.OnSuccess(Object object) { App42Response response = (App42Response) object; String jsonResponse = response.ToString(); } }NSString *storageName = @"storageName"; @try { App42Response *response = [geoService deleteStorage:storageName]; } @catch(App42Exception *ex) { int appErrorCode = ex.appErrorCode; int httpErrorCode = ex.httpErrorCode; if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } NSString *jsonText = ex.reason; }String storageName = "storageName"; try { App42Response response = geoService.deleteStorage(storageName); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = ex.getMessage(); }String storageName = "storageName"; try { App42Response response = geoService.deleteStorage(storageName); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = ex.getMessage(); }Coming Soonvar userName = "Nick", appErrorCode ; uploadService.getAllFilesByUser(userName,{ success: function(object) { }, error: function(error) { var geoObj = JSON.parse(error); appErrorCode = geoObj.app42Fault.appErrorCode; if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } } });String storageName = "storageName"; try { App42Response response = geoService.DeleteStorage(storageName); } catch(App42Exception ex) { int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = ex.GetMessage(); }$storageName = "storageName"; try{ $response = $geoService->deleteStorage($storageName); } catch(App42Exception $ex) { $appErrorCode = $ex->getAppErrorCode(); $httpErrorCode = $ex->getHttpErrorCode(); if($appErrorCode == 2903) { // Handle here for Not Found (No Geo Storage exists with name '@storageName'.) } else if($appErrorCode == 1401){ // handle here for Client is not authorized } else if($appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $ex->getMessage(); }Coming SoonComing SoonComing SoonComing Soon
Functions in Message API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
2900 - NOT FOUND - No destination found using given parameter Lat : '@lat' Long : '@lng' and Distance In KM '@distanceInKM'.
2901 - NOT FOUND - No destination found using given parameter Lat : '@lat' Long : '@lng' and Radius In KM '@radiusInKM'.
2902 - NOT FOUND - No Geo Storage exists.
2903 - NOT FOUND - No Geo Storage exists with name '@storageName'.
2904 - NOT FOUND - No Geo Points in the storage '@storageName' exist.
2905 - NOT FOUND - No destination found using given parameter Lat : '@lat' Long : '@lng'.