Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No coordinates found for my lat, lon #60

Closed
qadirsuh opened this issue May 10, 2017 · 4 comments
Closed

Error: No coordinates found for my lat, lon #60

qadirsuh opened this issue May 10, 2017 · 4 comments

Comments

@qadirsuh
Copy link

qadirsuh commented May 10, 2017

I am trying to execute the following Uber Api endpoint

Note: startLat=24.8793259&startLon=67.0570063 is coord of Karachi Pakistan
http://localhost:8000/api/getETAForLocation?startLat=24.8793259&startLon=67.0570063

here is the code

app.get('/api/getETAForLocation', function(request, response) {

  // extract the query from the request URL
  var query = url.parse(request.url, true).query;

  // if no query params sent, respond with Bad Request
  if (!query || !query.startLat || !query.startLon ) {
    response.sendStatus(400);
  } else {
    uber.estimates.getETAForAddressAsync(query.startLat, query.startLon)
    .then(function(res) {
        response.json(res);
    })
    .error(function(err) {
      console.error(err);
      response.sendStatus(500);
    });
  }
})

I am getting this Error log on my console

{ Error: No coordinates found for: "24.8793259"
    at /Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/node-uber/lib/Uber.js:64:42
    at Request._callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/geocoder/providers/google.js:20:5)
    at Request.self.callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1091:12)
    at IncomingMessage.g (events.js:286:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:973:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  cause: 
   Error: No coordinates found for: "24.8793259"
       at /Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/node-uber/lib/Uber.js:64:42
       at Request._callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/geocoder/providers/google.js:20:5)
       at Request.self.callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:188:22)
       at emitTwo (events.js:106:13)
       at Request.emit (events.js:191:7)
       at Request.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1171:10)
       at emitOne (events.js:96:13)
       at Request.emit (events.js:188:7)
       at IncomingMessage.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1091:12)
       at IncomingMessage.g (events.js:286:16)
       at emitNone (events.js:91:20)
       at IncomingMessage.emit (events.js:185:7)
       at endReadableNT (_stream_readable.js:973:12)
       at _combinedTickCallback (internal/process/next_tick.js:74:11)
       at process._tickCallback (internal/process/next_tick.js:98:9),
  isOperational: true }

And on browser I get

Internal Server Error

But when I try same Api with Zurich Coords. i.e 47.3769° N, 8.5417° E
http://localhost:8000/api/getETAForLocation?startLat=47.3769&startLon=8.5417
Its returns no any error but empty response on browser

{"times":[]}

@dawsbot
Copy link
Collaborator

dawsbot commented May 10, 2017

Before launching into any debugging, I'm thinking that there might be a bug with decimal precision? Notice how the coordinate 24.8793259 has seven decimal places and fails while 47.3769 has four.

Have you poked around removing some of the precision on the "Karachi Pakistan" address @qadirsuh? I'm curious if 24.8793 would work

@qadirsuh
Copy link
Author

qadirsuh commented May 11, 2017

Wow! this worked but returned empty results like zurich coords now
http://localhost:8000/api/getETAForLocation?startLat=24.8793&startLon=67.05701

Response:
{"times":[]}

@dawsbot
Copy link
Collaborator

dawsbot commented May 11, 2017

I'm not sure whether uber.estimates.getETAForAddressAsync supports lat/long. I see the examples in the readme using addresses. Is there somewhere which makes you think that a lat/long should work there?

You should instead use uber.estimates.getETAForLocationAsync

@qadirsuh
Copy link
Author

qadirsuh commented May 11, 2017

Ahh it was my mistake.
uber.estimates.getETAForLocationAsync(query.startLat, query.startLon) worked for me.

I was passing the lat/lng in uber.estimates.getETAForAddressAsync method, thats not make sense I need to use the method uber.estimates.getETAForLocationAsync and yes it worked.

Thanks for your time :)

Here is the output now
{"times":[{"localized_display_name":"UberGo","estimate":900,"display_name":"UberGo","product_id":"a9959e64-9984-490e-9f98-5227c808ee54"},{"localized_display_name":"uberX","estimate":540,"display_name":"uberX","product_id":"723712ad-8927-4d90-ab41-9e8da4908e2a"}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants