I tried using reverse geocoding of Google Maps (translating a location on a map to a human-readable address) using the JavaScript API, and I wanted to filter the results to get only street addresses.
As I saw in the documentation , result_type optional result_type parameter for this request, but when I specify it, I get the following error:
InvalidValueError: unknown property result_type
I turned on the API by downloading this script: https://maps.googleapis.com/maps/api/js?key=MY_API_KEY
And here is the code that I use for reverse geocoding:
geocoder = new google.maps.Geocoder(); geocoder.geocode( { location: {lat: parseFloat(lat), lng: parseFloat(lng)}, result_type: 'street_address' }, function(results, status) { if (status === 'OK') { console.log(results); } } );
Small playground: https://jsfiddle.net/scebotari66/30nshzb6/ .
However, when I try to do this with a direct HTTP request ( https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224--73.961452&result_type=street_address&key=MY_API_KEY ), everything works as expected.
source share