Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Cannot get distance calculation from Database

Hi

I can get get the distance between my location and multiple locations from the Appery mongo Db but when I use XHR2 it does not work.

This is my call to the REST DB which returns all the records in the table perfectly
var url = "http://xxx.xxx.xxx.xxx/api/_table/rides";
var Rides = XHR2.send("GET", url, {
"headers": {
"X-DreamFactory-Api-Key": "83edb3c5b591ac2e15ed36d34224dexxxxxxf8e"
},
});

This is my response data:
{
"resource": [
{
"rideType": null,
"doThu": null,
"pickupRaduisFlex": null,
"maxPassengers": null,
"dateCreate": null,
"userID": 1,
"dropoffRadiusFlex": null,
"endLAT": null,
"pickupTime": "10:00",
"startLocation": "Johannesburg",
"arrivalTime": "11:00",
"endLNG": null,
"endLocation": "Pretoria",
"startLNG": "28.037612",
"startLAT": "-25.946367",
"onceOffDate": null,
"doFri": null,
"rideIsFull": null,
"rideID": 1,
"dateDeleted": null,
"doSat": null,
"doTues": null,
"deleted": null,
"doMon": null,
"doSun": null,
"dateUpdate": null,
"isOnceOff": null,
"doWed": null
},
{
"rideType": null,
"doThu": null,
"pickupRaduisFlex": null,
"maxPassengers": null,
"dateCreate": null,
"userID": 1,
"dropoffRadiusFlex": null,
"endLAT": null,
"pickupTime": "08:00",
"startLocation": "Durban",
"arrivalTime": "13:00",
"endLNG": null,
"endLocation": "Johannesburg",
"startLNG": "28.037800",
"startLAT": "-25.946900",
"onceOffDate": null,
"doFri": null,
"rideIsFull": null,
"rideID": 2,
"dateDeleted": null,
"doSat": null,
"doTues": null,
"deleted": null,
"doMon": null,
"doSun": null,
"dateUpdate": null,
"isOnceOff": null,
"doWed": null
}
]
}

Now I need to do a distance calculation and this is where the problem lies. I loop through the data but nothing is returned. This is my code.....

for (var i = 0; i < Rides.length; i++) {

Code: Select all

   var lat = JSON.parse(Rides.body).Rides[i].startLAT; 
   var lng = JSON.parse(Rides.body).Rides[i].startLNG; 
   var distance = getDistance(lat, latitude, lng, longitude); 

   // If the customer's coordinates are within the radius, 
   // add the customer record to the results array 
   if (getDistance(lat, latitude, lng, longitude) ) it returns all the data above but without distance. 

Please can you assist.
Thank you.

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Cannot get distance calculation from Database

I am posting this because get satisfaction is not displaying a part of the code I posted above???? Here is the missing part.

for (var i = 0; i < Rides.length; i++) {

Code: Select all

   var lat = JSON.parse(Rides.body).Rides[i].startLAT; 
   var lng = JSON.parse(Rides.body).Rides[i].startLNG; 
   var distance = getDistance(lat, latitude, lng, longitude); 

   // If the customer's coordinates are within the radius, 
   // add the customer record to the results array 
   if (getDistance(lat, latitude, lng, longitude) ) it returns all the data above but without distance. 

Please can you assist.
Thank you.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Cannot get distance calculation from Database

Hello Deon,

Unfortunately this is something outside the scope of standard Appery.io platform support. You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Cannot get distance calculation from Database

Time to find another platform. This is ridiculous.

Look at all similar posts that is supported. Why does this not apply to everyone then?
Maybe because I complain about all the bugs too much!?

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Cannot get distance calculation from Database

Deon, let me know if you need help. We've got so much experience on this platform with geolocation and do geolocation as part of our business ... be happy to do this gratis ... no charge ....

Bruce

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Cannot get distance calculation from Database

Ps .. a href="mailto:Bruce.stuart@the-software-studio.com" rel="nofollow"Bruce.stuart@the-software-studio.com/a ... day and a time when you're free and can do a Skype or webex...

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Cannot get distance calculation from Database

Thanks Bruce, I will take you up and I am willing to pay. Just cant afford Appery's prices.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Cannot get distance calculation from Database

:-) perfect ... let's chat soon ... email me with a date and time ? Let's see how quick we can solve this

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Cannot get distance calculation from Database

I sent email. Yesterday. Let me know if you did not receive it.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Cannot get distance calculation from Database

I'm sorry I didn't receive it ...please try a href="mailto:bruce.stuart@5sinvestments.com" rel="nofollow"bruce.stuart@5bsinvestments.com/a

Return to “Issues”