[Qgis-user] Zoom QGIS to specific location by command line

Adam Nielsen a.nielsen at shikadi.net
Tue Apr 4 19:18:45 PDT 2023


> I would like to zoom QGIS to a specific location (lat/lon coordinate)
> or area (lat/lon bounding box) using a command line argument
> generated outside of QGIS. I have looked through the available
> command line arguments and cant see anything that will allow this.

I'm not sure whether you mean you want to load QGIS with a project
showing a particular location, or whether QGIS is already running and
you want to use a command line to zoom the already running QGIS to that
location.

> Does anyone know of a method that this could be accomplished?

If you are loading a new QGIS instance it looks like --extent will open
it with a specific view?

I'm not familiar enough with it to know what values to pass, but if you
get the view how you want it then create a new spatial bookmark (on the
View menu) and then look at the properties of that, it will show you the
extents.  They appear to be lat/long if that's what your CRS uses.  If
not, you might have to change the project CRS to one that uses lat/long.

Note that I haven't tested this and I'm new to QGIS myself, so my
apologies if this turns out to be incorrect.

Cheers,
Adam.


More information about the QGIS-User mailing list