I am learning how to use QGIS and I have some geophysical data; aeromagnetic and gravity data that I would like to visualize. The data is currently in CSV format and I am unsure how I should go about processing the data to import it into QGIS. My logic would be to import it as a raster with each point being located with the x and y values, then to interpolate by some means and contour whatever value corresponds to the gravity/magnetic reading for that point before shading based on some colour scheme. The gravity data for example has column headers with the associated text/data, headers text shown in the screen grab below.

Column Headers

the first couple lines when opened in excel

My main questions are:

  • is my logic correct?
  • If so, out of the possible options for values to contour with, which one should I use? e.g. observed gravity, bouguer anomaly etc.
  • Similar question goes for the magnetic data?

Magnetic data


It seems like the root of your question is: "How should I import and use my CSV?" So I attempted to provide some basic guidance, and direct you to additional resources that will help you understand how to proceed.

  1. Import your CSV as a delimited text layer. QGIS should automatically detect that the "geometry" is stored in the LATITUDE and LONGITUDE columns. Check that it has correctly assigned LONGITUDE as the X field, and LATITUDE as the Y field. Make sure the attribute table preview looks okay. Click OK.
  2. Now you have a point layer (that's a vector). Each row from your spreadsheet is now a single point feature. The rest of the cells in that row are assigned to that feature as its attributes.
  3. If you like, you can apply a graduated symbology based on the "observed_grav" field. This will give you a general idea of where the observed gravity is higher or lower on the map. However, if the point coverage is not uniform, there will be coverage gaps. You can fill those gaps through a process called interpolation.
  4. Optional. You can convert the points directly to contour lines, using the Contour plugin, as discussed here. This method allows you to skip the middle step of creating a raster. If you want a raster, proceed to step 5.
  5. You can convert the point data to a raster. This process is called interpolation. There are several different methods of interpolation, which you can read about in this tutorial and in the QGIS Training manual here and here and in the QGIS User Manual. There are many different blog posts and discussions about how to choose an interpolation method.
  6. Once your data is a raster, you can style it to suite your needs. Have a look at this section of the QGIS User Manual raster, and the other QGIS documentation. You can somewhat mimic the appearance of contours through raster styling. Try applying a color ramp in the "singleband pseudocolor" style. Try the style "paletted/unique values" with random colors or a color ramp.
  7. Optional. If the raster styles appear too blocky/jagged/pixelated for you, convert your raster to contours with the GDAL > Raster conversion > Contours tool (in the Processing Toolbox).
  8. Once the contour lines are created, convert them from lines to polygons with the 'lines to polygons' tool. Then apply a color ramp using a graduated or categorized style.
  • Thanks that is very helpful! Now if I wanted to export the interpolated result, raster as a uniform grid (aim is so I can create a numpy array and use matplotlib to do some additional processes), is there a simple way to do this? – Jasper Mowatt May 3 at 13:30
  • A raster is already a uniform grid, so I'm not entirely sure what you're asking for here. Maybe try ASCII format. If that doesn't work, ask this as a new question. – csk May 3 at 13:57

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.