I have 4 .tif files that I have loaded in QGIS and I am looking to extract data at very specific locations using mutant. I have the points I want loaded in as a csv file and there is a large number of them. Whilst I could manually go to each point and use mutant to locate the data I'm looking for the process can be quite tedious and can be open to errors. Is there a way to automate this process?

Steps I want to automate:

1. Send cursor to specific location
2. Use a click event or manipulate mutant to retrieve data at that point
3. Export that data to a csv or dataframe like structure
4. Iterate over to next location

I have read up on this link which only seems to provide me half the answer and not how to send a click event or manipulate mutant. Is there a way to take control of the mouse pointer using python in QGIS?

I am familiar with python and that is what I intend to use to automate this process

  • Are you just wanting the pixel RGB values at the x/y locations? Also, do the tif images overlap? – artwork21 Apr 12 '18 at 15:06
  • Yes the tif images overlap and if by RGB values you mean the value of the tif image at those specific co-ordinates then that is what I'm looking for. – cd123 Apr 12 '18 at 15:41

You can definitely automate this using python (pyqgis). Here is one approach:

  1. Load all the tifs into QGIS
  2. Using python loop through the csv and set variables for the x, y values
  3. Use this q/a answer from gene to get the raster x/y pixel value, Retrieve pixel value from raster layer in pyQGIS

I'm not sure if the tifs have the same pixel values at their overlap, but you may want to take that into consideration when pulling values out if a location is at an overlap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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