13

I have used Google geo address and using lat/long have got the address. How do I determine if I am on road on not? Basically hit-test for road? I am currently using location manager for lat/long and the GeoAddress is same for on road and next to road.

2 Answers 2

11
+50

Final Solution

Use reverse geocoding via the Google Geocoding API.

The term geocoding generally refers to translating a human-readable address into a location on a map. The process of doing the converse, translating a location on the map into a human-readable address, is known as reverse geocoding.

The Geocoding API supports reverse geocoding directly using the latlng parameter. For example, the following query contains the latitude/longitude value for a location in Brooklyn:

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false 

The docs explain how to interpret the json results but StackOverflow has various answers addressing more efficient ways to parse the data.

Possible Solutions

Quick Search Results

Unsolved Similar Questions

Sign up to request clarification or add additional context in comments.

11 Comments

@JSuar exactly as Mr.Johnson stated.
Sorry about that. Updated my answer. If none of these links prove useful, I will delete my answer. Still researching, however.
@JSuar Thanks again for your time and effort.
econym.org.uk/gmap/example_snap.htm snaps to nearest road how does it know where the road is ? Its interesting .Can we implement the same on android google maps v2 ?Let me know any workaround.Thanks again for your time.
@jason That solution relies on loadFromWaypoints. This SO question provides a solution to the restrictions placed on the function.
|
4

See fiddle.

It can be done so much easier with OSRM (nearest) webservice. Make a GET request like:

const url = '//router.project-osrm.org/nearest/v1/driving/'; fetch(url + coord.lon + ',' + coord.lat).then(function(response) { return response.json(); }).then(function(json) { if (json.code === 'Ok') { console.info(json.waypoints[0].location); } }); 

Which is a road/street coordinate.

References — Project-OSRM

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.