I'm going to build a QGIS standalone application. According to the requirements full extent equals to the extent of a predefined rectangle (say bounding box of a parcel). The application should start in full extent view. When zoomed in the user is restricted to only pan inside the area given by full extent (using pan tool or sliding scrollbars), similar to the issue in this question.

Which is the appropriate QGIS API function or how can I mimic this behaviour using Python?

1 Answer 1


You can listen to the extent changed event and reset it back if it goes outside of the bounds:

def extentsChanged():
   extent = iface.mapCanvas().extent()
   outofbounds = # Do your check
   if outofbounds:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.