Hi,
see
https://qgis.org/pyqgis/master/core/QgsGeocoderContext.html#qgis.core.QgsGeocoderContext
You can use it to define an area of interest and to specify
transformation settings.
I guess this should work:
geocoder_context =
QgsGeocoderContext(QgsProject.instance().transformContext())
geocoder = QgsGoogleMapsGeocoder(apiKey="foo")
for geocoder_result in geocoder.geocodeString("bar", geocoder_context):
print(geocoder_result)
Cheers, Hannes
On 8/7/25 17:05, Guillermo D'Angelo via QGIS-Developer wrote:
Hi there!
Does somebody have an example or snippet on how to use the
"QgsGoogleMapsGeocoder" class from PyQGIS?
I want to geocode a string using the method "//geocodeString" but I
don't undestand what is the qgis.core.QgsGeocoderContext class and how
to use it.
Thanks a lot.
------------------------------------------------------------------------
Guillermo D'Angelo
Encargado del Departamento de Geografía
División de Trabajo de Campo
Dirección Nacional Transferencias Monetarias y Análisis de Datos
Av. 18 de julio 1453 | Piso 1
Tel.: (+598) 2400 0302, int. 1262
[email protected] <mailto:>
www.mides.gub.uy <http://www.mides.gub.uy>
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Johannes Kröger
GIS-Entwickler/-Berater
WhereGroup GmbH
Lange Reihe 29
20099 Hamburg
Germany
Tel: +49 (0)228 / 90 90 38 - 36
[email protected]
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer