Google Maps Geocoding API, an API function missing from their JS api (?)

The problem is simple: in the documentation for the geocoding API, they say that component filtering does exist. (Source: https://developers.google.com/maps/documentation/geocoding/ )

However, if I look at the JS documentation ( https://developers.google.com/maps/documentation/javascript/geocoding ), it does not seem to be implemented. However, I remember that Google previously used functions that were implemented but not written in their API, so I wonder if anyone knows how to filter components using the Google Maps geocoding API?

Thanks!

+6
source share
1 answer

The documentation seems to be implemented right now. Anyway, here is the code:

geocoder.geocode( { 'address': address, 'componentRestrictions':{'country':'GB'}}, function(results, status){ ... }); 

Used to limit results in a specific area. A filter consists of one or more: route, locality, administrative, postal code or country. Only results matching all filters will be returned. Filter values ​​support the same spelling correction and partial matching methods as other geocoding requests. See the Component Filtering section of the geocoding web service for more information.

+7
source

Source: https://habr.com/ru/post/947690/


All Articles