iphone - How to get nearby places from Google SDK using iOS and Swift? -
how can nearby location google sdk in ios , swift? need nearby places without type , category?
client don't want use url: https://maps.googleapis.com/maps/api/place/search/json?location=lat,long&radius=1000&sensor=true&key=key
you can this api call: https://maps.googleapis.com/maps/api/distancematrix/json?origins=51.226531,4.190688&destinations=51.114476,4.139618|51.148123,4.182590
there 3 parameters in url ,
json used return response
origins contains long , lat of current location of user and
destination contains addresses form want find nearest distance. addresses in long , lat format , seperated "|".
the response follow
{ "destination_addresses" : [ "dorpstraat 70, 9140 temse, belgië", "eigenlostraat 38, 9100 sint-niklaas, belgië" ], "origin_addresses" : [ "provinciale baan 37, 9120 beveren, belgië" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "16,3 km", "value" : 16346 }, "duration" : { "text" : "22 min.", "value" : 1321 }, "status" : "ok" }, { "distance" : { "text" : "10,5 km", "value" : 10521 }, "duration" : { "text" : "17 min.", "value" : 1003 }, "status" : "ok" } ] } ], "status" : "ok" }
all have nearest destination on time basis .
cheers
Comments
Post a Comment