I have this project which uses GMSKit
(GoogleMap kit) in iOS(ObjectiveC) and there is a requirement that some random points are to be generated near the user's current location.
I have successfully generated random points but now what I want is to generate some random points at say _0.5kms away from the user and the random points has to fall on a road.
I have gone through most of the stackoverflow questions and answers and referred so many other google sites which give idea about this.
Can someone help me with this issue ? I am very confused. Thanks to everyone in advance. Happy Coding.
You can use Google's Road API for that. It has two calls that you can use to find roads near certain coordinate(s).
https://developers.google.com/maps/documentation/roads/intro
1. Snap to roads:
You send a path of coordinates to the API and it returns another path of consists of roads (as Google places ids) that are close to your path. This only works for a path (a list of coordinates)
https://developers.google.com/maps/documentation/roads/snap
2. Nearest roads:
If you want to find the nearest roads to one single coordinate you can use the nearest roads call. It takes coordinate(s) as parameter and returns a list of roads that are near that point. This works with a single coordinate so it might be more useful in your case.
https://developers.google.com/maps/documentation/roads/nearest
Boths calls return coordinates and google places ids for the found roads. You can then check the distance to your point to check if you are on a road. You can use these id in other Google APIs (e.g. Google Places API) to get more information on the found roads.