mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
This geocoder utilises the Google Maps "geocoding" API in order to geocode strings. The Google Maps service is not publicly available, and accordingly an API key must be first obtained from Google and specified when constructing this class. (The user is responsible for managing their Google Maps API key, and ensuring that the use of this geocoder does not exceed their usage limits! Excessive use of the Google Maps geocoder API can result in charges being applied to the API key holder.) This is raw underlying API only. It is intended to be exposed to QGIS users only via plugins, and does not result in any out-of-the-box Google Maps functionality. In order for a plugin to use it, they must do something like this: # create a google maps geocoder api_key = 'my api key' coder = QgsGoogleMapsGeocoder(api_key) # add it to the locator bar filter = QgsGeocoderLocatorFilter('Google', 'Google', 'addr', coder, iface.mapCanvas()) iface.registerLocatorFilter(filter) Mini FAQ: Q: Why is this being added to core, instead of a plugin? A: While a plugin would be perfectly acceptable if we are only targetting QGIS desktop, the intention here is to allow this underlying, low level class to be reused outside of QGIS desktop (e.g. on QField) with a minimal amount of duplicate effort.