airsoftFreak airsoftFreak - 1 month ago 9
iOS Question

How do i calculate the distance from point A to point B in IOS google maps SDK?

My goal is to simply calculate a distance from point A to point B using IOS google maps SDK.

I found out that there is an API call Distance Matrix API. The questions are


  1. Do i need to make an HTTP request using Alamofire IOS to use
    Distance Matrix API?

  2. Do i need to run my own server (etc Node.js, django, rails) to make
    a request to the Distance matrix?

  3. Or everything is in IOS google maps SDK?


Answer

1 -> Yes, you need to make a HTTP request.

2 -> No, you do not need to run your own server. You just need a google API key with which you make requests to Google servers. You can get the API key by creating a google account and following the instructions in the below link:- https://developers.google.com/maps/documentation/distance-matrix/start

3 -> You do not need to integrate the full iOS Google SDK if you need to perform only one of these tasks from the SDK. You can just hit the API following the instructions from the below doc Distance Matrix API doc:- https://developers.google.com/maps/documentation/distance-matrix/intro?hl=en#RequestParameters