Skip to main content
100%

Zoom to your current location in QGIS (assuming EPSG 4326)

✓ Published0🌍 Public
Aalpha-beta-soup
Last edited Aug 16, 2015
Created on Aug 16, 2015

This example shows QGIS automatically centering its map canvas on the viewer’s current geographic location. The map extent is set to a fixed 0.01-degree square around the coordinates obtained from the IP geolocation service ipinfo.io. The code uses the Python `pycurl` library to fetch the JSON response, `json` to parse the latitude and longitude, and the QGIS Python API (`qgis.utils.iface.mapCanvas()` with `setExtent` and `QgsRectangle`) to update the view. No additional mapping libraries are used beyond QGIS’s native canvas.

AI-generated description

Similar vizzes