0

Imagine I am a user/Uber driver, how can I use the Uber API to get my current location and plot the location on the map? I want to track the user on the map. All this to be done using Python API.

2 Answers2

1

The API endpoint /requests/current responds with a location object including lat & lng values. You could use these for your mapping feature. Otherwise, there's another method /requests/{request_id}/map that responds with a URL to a map provided by the API.

As for Python, the SDK provides you the above-mentioned methods:

Alexander Graebe
  • 797
  • 5
  • 10
  • That's only possible when I have a ride, what if I don't . How will I get my location then? – Abhinav Gupta Jun 24 '16 at 19:57
  • Well, if you don't have a ride it's up to you to identify the user's location. The Uber API itself is not a location provider in that sense. You'd need to use the underlying technology to get a user's position. For instance, if you're using pure HTML on the front-end, you could obtain the location through [HTML5 Geolocation](http://www.w3schools.com/html/html5_geolocation.asp) features. – Alexander Graebe Jun 24 '16 at 20:11
0

Through Python you can their IP address to track their location. This question talks about how to use FreeGeoIP to track their location. Using the IP address won't be perfectly accurate, so if you need a more accurate representation, you'll need a way to interact with the GPS system on a device. This question has an example of using Android and Python together, and agraebe mentioned you can use the HTML5 Geolocation features in his comment. Pythonista looks like a Python IDE for IOS that has a locations service. I don't have much experience with these, but I hope some of these resources help.

Community
  • 1
  • 1