I am working on creating a (remote) superficial geological map using ASTER imagery in QGIS. I have made several RGB composites including Abram's ratio and Thermal Infra red indices to aid in demarcating lithological boundaries.I'm digitizing lithology types manually depending on the spectral signatures.

This TIR composite image has 3 components, quarts index (RED), carbonates index (Green) and mafic minerals index (Blue) .i.e it shows how the pixels show spectral values depending on these 3 components. TIR indices RGB composite showing Quarts, Carbonates and Mafic mineral spectral signatures

The polygon layer, Lithology types

Since the majority of the pixels overlap among three components I am trying to create a Ternary diagram to show each pixel's spectral position, apices being Quarts index, carbonates index and mafic index. That is to ,say, where each pixel plots in this diagram But after this point I have no idea on how to appoach this.

How can I create a triple diagram to show the spectral position of each pixel where the vertices represent the quart index, carbonate index, and basic matter index and their possible combinations?

I have no experience in R or Matlab.

1 Answer 1


You need to sample the raster layers along points within the polygons.

1. Generate points inside the polygons in the polygon layer

For this you can use three methods. I will explain the simpler one, using Vector Creation > Random points in polygons (NOT Random points inside polygons). Select your polygon layer as Input polygon layer and enter the Number of points for each feature- say 35 and set a Minimum distance between points. This will create a new point layer with fixed number of random points inside each of the polygon feature. If you have rock types/lithology or any identifier as your polygon feature attribute, you can check the Include polygon attributes. Checking this option will add the attribute information to the generated points.

Random points in polygons

Alternatively, you can create regularly spaced points using Generate points (pixel centroids) inside polygons to generate points for each pixel of the raster layer inside the polygons or use Regular Points and then use Join attributes by location to join the polygon attributes with the point layer.

2. Sample raster values along the generated points

Now that you have your point layer with attributes, you can sample the raster layer with this point layer using Raster Analysis > Sample Raster Values. Choose your newly created point layer as Input layer and the imagery as Raster layer. Add an output column prefix if required. This will sample the raster layer along the points and generate a new point layer with the raster values as additional attributes. For each band in your raster layer, separate attribute fields will be created. In your case, there will be attribute fields corresponding to every index that you have stacked in the raster layer.

Sample Raster Values

3. Export the layer with sampled values and plot ternary diagram in a third party application

Export the layer generated in step 2 to excel/csv for data plotting in third party applications. Use any application like Grapher/ Excel templates/ QGIS plugins like Dataplotly to plot the ternary diagram. Select the columns corresponding to the sampled band values as the axes and use the rock type attribute for color coding/ styling your points (optional).

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.