[GIS] function to select a region of a map for further processing with Python

pyqgispythonqgisregion

I would like to select a map's region in QGIS for further processing with python console.enter image description here
Ideally I would like to select the region with a mouse drag (like Gimp crop function) and then e.g. analyze the elements inside that area using Python, take a snapshot the selected area and others stuff like these.
Is there a prebuilt function in QGIS that allows me to do that? I want to achieve this for many tasks, mainly to export the data, these are three examples:

1 Get the RELATIVE COORDINATES of attributes inside the selected area

What I need for an application is to get
coordinates relative to the selected area and not only the "geographical" CRS of the attributes.
enter image description here

E.g. if I have the attribute "DILLINGHAM" inside the selection (the image is from Alaksa data set Airports) I need to have the image coordinates of the label and the name field e.g. (X,Y, "label"):

(210,150,"ST "DILLINGHAM")
(200,350,"PORT HEIDEN")
...

So I would like to retrieve the position of the attribute relative to a simple reference system (my selection), where the 0 is a corner of my selection

2 Make a better clipper

I would like to use this function even for make a better clipper. Raster->Extraction->Clipper. When I work with may raster files I would like that QGIS allow me to clip only the rasters that are into my selection and not to show me all the list of other rasters that are not inside the selection as actually does.

3 Get a snapshot of the selection

Best Answer

In fact, Processing will only use the selected features - if there is a selection in the input layer. To verify, please check the Processing options:

enter image description here

Related Question