I am using the following functions to query from geopoints in parse.com, my class is called “allJobs” and the field having geopoints in parse is called “coord”. I am suspicious I havent used “coord” in the codes below.
Do I need to replace that “centerPoint” below with “coord”.
this is my query in Corona
headers = {} headers["X-Parse-Application-Id"] = "11223" headers["X-Parse-REST-API-Key"] = "111111" headers["Content-Type"] = "application/json" local params = {} local params = {} params.headers = headers local message1 = {} message1["geoPoint"] = { ["\_\_type"]= "GeoPoint", ["latitude"]= -42.785311, ["longitude"]= 147.527295 } params.body = json.encode ( message1 ) network.request( "https://api.parse.com/1/functions/InfectionCheck\_BETA","POST",getFeatured,params)
and this is my parse cloud function
Parse.Cloud.define("InfectionCheck\_BETA", function(request, response) { var geoPoint = request.params.geoPoint; var query = new Parse.Query("allJobs"); query.near("centerPoint", geoPoint); query.limit(10); query.find({ success: function(results) { var distances = []; for (var i = 0; i \< results.length; ++i){ distances.push(results[i].kilometersTo(geoPoint)); } response.success(distances); }, error: function(error) { response.error("Error"); } }); });