问题
If I use google maps geocoder to find a point of an address - I usually get a point in the middle of the building (roof top)
example:
https://maps.google.com/maps?q=350+Alabama+Street,+San+Francisco,+CA,+United+States&hl=en&ll=37.764842,-122.412077&spn=0.001497,0.002661&sll=37.794661,-122.425718&sspn=0.001496,0.002661&oq=350%2BAlabama%2BStreet&hnear=350+Alabama+St,+San+Francisco,+California+94110&t=m&z=19
Geocoder request:
http://maps.googleapis.com/maps/api/geocode/json?address=350+Alabama+Street+San+Francisco&sensor=false
so the point is actually in the middle of Harrison and Alabama streets
But I need to get a point that is located on Alabama street line
Is there a ways to do that ?
回答1:
You may request the directionsService instead of geocoding, this should return a location placed on the street when used with google.maps.TravelMode.DRIVING
https://maps.google.com/maps?saddr=350+Alabama+Street,+San+Francisco,+CA,+United+States&daddr=Alabama+St&hl=en&sll=37.764829,-122.412369&sspn=0.001043,0.002411&geocode=Fco-QAIdXiG0-ClZY3r_L36PgDG0YXVKn8-9fQ%3BFe4-QAIdrCK0-A&oq=350+Alabama+Street,+San+Francisco,+CA,+United+States&mra=dme&mrsp=1&sz=19&t=m&z=19
来源:https://stackoverflow.com/questions/17400232/google-maps-geocoder-point-on-a-street