0

I know the question is a little bit subjective, but bear with me, i will explain my current confusion

My goal is to build something similar like uber feature where i can track driver who has accepted my request, it will be on IOS only for now

1) There will be many drivers on the map

2) a consumer decided to go from current location to targeted location

3) one of the drivers accept it and now the consumer can track the driver

As to my research, I need to Google map sdk for IOS, and i need to know about google map web service api and as well as google distance matrix api.

Any advice on how to approach this problem? and do i need a serverside for this?

sinusGob
  • 4,053
  • 12
  • 46
  • 82

1 Answers1

1

By using the Google Maps Distance Matrix API, it will give you a service that provides travel distance and time for a matrix of origins and destinations. The information returned is based on the recommended route between start and end points, as calculated by the Google Maps API.

The required parameters are:

  • origin - it serves as the location/starting point for calculating distance and time.

origins=Bobcaygeon+ON|41.43206,-81.38992

  • destination - it serves as the finished point for calculating distance and time.

destinations=Darling+Harbour+NSW+Australia|24+Sussex+Drive+Ottawa+ON|Capitola+CA

The following example uses latitude/longitude coordinates to specify the destination coordinates:

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=40.6655101,-73.89188969999998&destinations=40.6905615%2C-73.9976592%7C40.6905615%2C-73.9976592%7C40.6905615%2C-73.9976592%7C40.6905615%2C-73.9976592%7C40.6905615%2C-73.9976592%7C40.6905615%2C-73.9976592%7C40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626%7C40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626&key=YOUR_API_KEY

Distance Matrix API also have optional parameters like:

  • mode (defaults to driving) — Specifies the mode of transport to use when calculating distance. Valid values and other request details are specified in the Travel Modes section.

  • avoid — Introduces restrictions to the route. Valid values are specified in the Restrictions section of this document. Only one restriction can be specified.

  • arrival_time — Specifies the desired time of arrival for transit requests, in seconds since midnight, January 1, 1970 UTC. You can specify either departure_time or arrival_time, but not both. Note that arrival_time must be specified as an integer.

  • departure_time — The desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. Alternatively, you can specify a value of now, which sets the departure time to the current time (correct to the nearest second).

For using GPS in Google Maps for IOS, you can check this SO question.

Community
  • 1
  • 1
KENdi
  • 7,576
  • 2
  • 16
  • 31