Prescription maps using QGIS

Does anyone here know how to create variable rate prescription maps in QGIS? Could you share a quick workflow summary for how that works in QGIS?

I’m just getting my feet wet in QGIS. I’m currently looking to use the maps with a DJI drone, which require a geotiff prescription file.

Seems like something that would have been discovered/mastered by the rate controller crowd.

Thanks in advance!

2 Likes

Hello there

Here are some steps to create variable rate prescription maps in QGIS; hopefully they will be useful. First; import your geographic information in QGIS. then Next use the raster calculator to combine your input layers into a single raster that represents the variable rates. In the end; define the formula based on your particular instructions needs. At last; make sure the output raster matches your requirements for geotiff format. Finally, export this raster layer as a geotiff file.

1 Like

Hi exo. Thanks for responding!

That’s a helpful overview of the workflow.

I’m currently stuck on figuring out how to create a raster square grid layer that takes the average color of an underlying source image.

Am I correct in using the vector tools to create a grid?

I’m lost on how transform/pixelate the source image onto that grid from there.

May be the enclosed video helps:

I haven’t actually used the VR but I played with it some. Basically I uploaded a .shp file into qgis and then adjusted the colors of each zone as a scale of red based on 0-255. So if your max rate is set at 255 and your min is at zero, if you want to target 80, set the red value at 80 and all other colors at zero. It’s important that green is at zero. In a nut shell and no field experience lol. Good luck

Thanks guys. This is getting closer. It’s like the brute force method of what I’m trying to do.

It’s helpful though. I’m learning about QGIS bit by bit.

Also, a bit of context might be worthwhile.

I trialed some software called “Pix4Dfields”. It’s built exactly for this sort of thing; especially for creating variable rate maps from aerial multi-spectral images.

For example, I could create a grid of specified dimensions, and overlay an aerial image and field boundary. You can also get vegetative index layers in there too, and then have the software fill the prescription grid layer based on math or indexes or whatever you can come up with.

Exporting in a format for my DJI drone was a breeze. The whole workflow is really simple easy and intuitive. The only downside is… you guessed it, cost. Upwards of $3k for a perpetual license or $300+ month to month. I don’t even know if I have a good use for it yet, but I’d like to play around with the ability to generate VR maps for my drone and to explore for other stuff in the future.

This got me wanting to replicate the workflow from an aerial image(s) to a geotiff VR map in QGIS.

I think I figured it out. The key was something called “zonal statistics” which can do calculations on a raster image over an area defined by a vector layer.

I can share some screenshots if anyone else is interested.

What image format is the rate controller crowd using for prescriptions? Is it based on vector shapes? I haven’t played with any of the rate controller stuff yet.

can share some screenshots if anyone else is interested.

Please do share, I took a brief look at this but it is not easy!

Here’s an overview of what I did so far:

  1. Get a raster image. I just used a screenshot of a google earth image for this practice/learning.
  2. Geo locate the image using the Raster->Georeferencer tool

    a. Open your image
    b. Click reference points on the image.
    c. Correlate them to another image layer in the project with the “From Map Canvas” button
  3. Create/import a boundary polygon. I drew one, but you could also import a .shp file for a field boundary
  4. Create the grid using Vector->Research Tools->Create grid
    image
    a. Fill out the fields in the dialog.
    b. Choose grid type. I used a rectangle (square)
    c. Grid extent: use the “…” button to select Calculate from Layer->“your boundary path layer”.

    d. Horizontal/vertical spacing = dimensions of the rectangle. I chose 25 feet for both, just in this practice case.
    e. Click “Run”. It should create a new layer and something that looks like a grid!
  5. Run “Zonal Statistics” to perform a calculation over the grid cells. You are essentially setting up a calculated data column for each vector shape or cell in the grid. The end goal in my case, was to have an average of the “green” in each grid cell for the aerial image.
    a. Show the processing toolbox sidebar by clicking Processing->Toolbox

    b. Search for “zonal statistics” and you should find it
    c. Fill out the stuff in the dialog box

d. Input layer: this is the grid layer. select the grid layer you just created.
e. Raster layer: this is the image layer that it will do the calcs on
f. Raster band: the color of each pixel of an image is described by Red, Green, and Blue values. You’re choosing which color band to use for the calculations here. I chose “Band 2 (Green)” in this practice example.
g. Output column prefix: you have to put something here, not sure why. What ever you put here gets appended as the prefix to the data columns that get calculated.
h. Statistics to calculate: click the “…” to choose. I only chose “mean”, which means this calculation will essentially just calculate the average green-band value for each grid cell.
i. Click “Run”.
6. A new grid layer gets created. You can check the calculated values by right clicking the newly created “Zonal Statistics” layer → Open attribute table.


You can see the calculated data columns. Each row is a cell in the grid. In this case, I accidentally had selected mean, sum, and count as calculated statistics. I only really wanted the mean for what I was trying to do.

7. Now that I had a calculated average for each grid cell, I wanted to color the grid along a spectrum based upon that value.
a. Right click on the Zonal Statistics layer->Properties
image
b. Go to the “Symbology” section
c. Select “Graduated”
d. Value: Choose the value that will be used to determine the fill color. In this case, I wanted the calculated “_mean”
e. Choose the color ramp you want. I did blue to red.
f. Classes: This is the number of color stages/zones you want. I chose 3. You could increase or decrease, depending what exactly you want for an application map.
g. Click “Classify”. This creates buckets/color zones. I think you can play with the “Mode” a bit to tweak how the different zone values/criteria are created. I haven’t really yet.

h. Click “Apply”

You should now have created a vector grid layer that is colorized based upon the calculated green spectrum average.

I’m still working on figuring out how to basically convert this back into a raster/geotiff image specifically for use for my DJI T40 drone.

3 Likes