richardaum
richardaum

Reputation: 6777

Google Maps API - Getting Street Coordinates

Does Google Maps API have any way to get the street coordinates of a location?

I want to get the nearest street coordinate. To get this I need, for example, all coordinates that compose a street.

Is there something like this?

Upvotes: 11

Views: 14147

Answers (3)

Jon Watte
Jon Watte

Reputation: 7198

Google has rearranged the maps API significantly since the question was asked.

The best way to turn a location (long, lat) into a "point on road" now is to use the snap-to-road or nearest-road service: https://developers.google.com/maps/documentation/roads/snap

Note that this API charges a cent per API call, and can take up to 100 distinct points per call. If latency and complexity aren't problems, if you need to answer this question on a client, you could build a server that collects up to 100 requests from different clients, makes one request to Google, and then returns the request data back to the appropriate clients (for this use, make sure to use nearest-road, not snap-to-road).

Also, currently, Google Maps has a $200 per-month statement credit available, which may make smaller uses of this API not actually end up costing much (or anything at all).

Upvotes: 3

Fagner Brack
Fagner Brack

Reputation: 2403

I found this (ReverseGeocoding in v3): https://developers.google.com/maps/documentation/javascript/geocoding#ReverseGeocoding

Upvotes: 6

Dr.Molle
Dr.Molle

Reputation: 117314

You may use the directionService.

Pass the given address(or location) as origin and destination to directionsService.route() and use the travelMode DRIVING . The response should contain the nearest street.

Demo: http://jsfiddle.net/doktormolle/W3VGN/

Upvotes: 19

Related Questions