Creating isohyetal lines in QGIS

We had a pretty extraordinary rain storm in our region some weeks ago. Accumulated rainfall over a 24 hr period was between 20-100 mm in a region where the total annual precipitation is about 50 mm.! I got rain gauge data for the event and made isohyetal lines using only tools available in Quantum GIS.

First I imported the data table including XY locations and the precipitation with the Delimited Text plugin. Then, in order to limit the analysis more or less to the area covered by the rain gauges, I made a “convex hull”, the minimum polygon enclosing all points, and buffered that polygon by 10 km. (allowing that the interpolation algorithm will give approximate values outside the area covered by the gauges).  Both of these operations are available in the Vector->Geoprocessing menu.

Now I fired up the GRASS plugin to do the interpolation. Using the v.in.ogr.qgis module, I loaded both the rain gauge point vector and the buffer polygon vector into a suitable GRASS Location/Mapset. First I converted the buffer polygon to a raster so that I could use it as a mask with v.to.rast. After adding the two GRASS layers to the map – the rain gauges, and the mask raster,  I pulled up the r.mask module to force the next action to be limited to the buffer region. Then I ran v.surf.rst to produce an interpolated rainfall grid. I chose, of course, the precipitation column as the attribute field for doing the interpolation. The new precipitation grid was created in a few moments, and I closed the GRASS toolbox.

Now I activated the new GDALTools Raster plugin. Among the tools there is “Contours”. I ran this tool, choosing the GRASS precipitation raster as input. I left the default levels value at 10, and chose an output directory where the contours shapefile will be saved. I also checked “Attribute Name” and typed in “Precip”. The contours were created and here’s my resulting map:

isohyets
Precipitation map - january 2010
Precipitation map – Jan 2010

35 thoughts on “Creating isohyetal lines in QGIS

  1. Hello Esdras:
    I’d be pleased to help. Do you have any specific questions? Perhaps fill in some more details:
    What data do you have?
    What have you tried so far?
    Regards,
    Micha

  2. Hello Micha,
    I have a spreadsheet format .ods (.xls) with the coordinates X, Y and Z value corresponds to the salinity of a lagoon that I am studying. Would you like to follow the estimate of this parameter over 12 months. Are approximately 35 sample points in an area of 27000 square meters. I have experience in doing this using the GoldenSoftware Surfer, but I would like to migrate the program. I just replaced the Arcgis for gvSIG and am looking for a replacement for the Surfer.
    However, I have none experience in Grass, even using the QGis as GUI.
    I read your post and was interested in the result. This is exactly what I intend to do, and with other datas.
    I look forward to your reply. And thanks in advance.
    Sorry for my english. I’m brazilian.

  3. Hi
    This sounds encouraging, I add my voice to Esdras, can you provide us with a complete step by step procedure for doing this?.
    p.s I have installed Arcmap 9.2

  4. ׁHi Ibrahim:
    What in the above description needs more explanation? If you’re trying QGIS, let me know how far you got, and I’ll try to fill in more details. You might want to start with the QGIS manual:
    http://download.osgeo.org/qgis/doc/manual/qgis-1.3.0_user_guide_en.pdf

    If you’ll be staying with ArcGIS software, then I’m pretty sure you will need the Spatial Analyst extension to do the interpolation of point data to a raster.
    However, open source GRASS GIS offers several very well regarded interpolation routines such as v.surf.rst. This module is the most suited for environmental data such as rainfall, where it’s not necessary that the interpolated surface go exactly thru the data points.
    So, if you have your data with X-Y locations in a spreadsheet table, export to a *.csv (comma separated value) text file, and use the “Delimited Text” plugin to pull the data into QGIS. Let me know how this goes, and we’ll continue from there…

  5. Hello,

    That is extremely interesting.

    However, I would like to know one detail: how do you “buffer by 10km”? My geoprocessing tool buffer comes with no units (i.e. it is set as a proportion of my starting polygon). It would be much more practical to have a buffer in sensible units like kms.

    Is it a projection matter? I’m in a projected coord sys now (NAD83, MTM 4), so I would expect kms to mean something…

  6. The buffer units are the same as the units of your current projection. So If you’re in the MTM zone 4 projection, then the units should be meters. So set the buffer distance to 10,000 for 10 km.
    HTH

    Micha

  7. I’ll be damned. I was sure I’d done that and that it hadn’t worked. But, CQFD, it works now. Thank you very much for answering, especially so much later!

    Since you’re so helpful, I’m not sure what you refer to by “I fired up the GRASS plugin”. You see, I had never used GRASS before, but I did try after reading this. Three hours of tutorials later, I still haven’t figured it out. Any detailed instructions you can offer would be much appreciated. Specifically, do I need to make my buffered polygon into a mapset? If so, how do I do so (I failed so far)? If not, how do I “fire up the GRASS plugin”?

    Thank you for your patience with this good-willed noob…

  8. Can I suggest that you grab the QGIS user’s manual [1] (if you haven’t already) and have a look at the GRASS plugin section.
    There you’ll find explanations on starting with GRASS, setting up you LOCATION and MAPSET and importing data. It’s available in 4 languages BTW.
    Briefly, you’ll want to set up a LOCATION based on the MTM zone 4 projection. Then define a MAPSET. The LOCATION is always locked to a specific projection, and the MAPSET usually represents map layers that are all part of a project you’re working on. Next import the layers into that MAPSET, and then you can start using GRASS tools on those layers. Sounds involved, but QGIS makes it quite simple.

    And if you feel ambitious, you can also startup GRASS on its own, pointing to that same LOCATION/MAPSET and work with the same layers straight in GRASS, without the QGIS interface. Then when you’re finished, any new GRASS layers you’ve produced will also be accessible from within QGIS for designing printable maps.
    If you get tripped up with any specific problems, post back, or directly to the QGIS or GRASS mailling lists for further help.

    [1] http://www.qgis.org/en/documentation/manuals.html

  9. Thank you for the continued help!

    I had actually read the manual section on GRASS and tried the procedure to set up a new location. However, every time I try through the Quantum interface, the procedure ends with the error message “g_make_location failed” with nothing more helpful than that. I have really no idea what could cause the new location to fail…

    So I had tried doing it directly in GRASS… I’d tried to create a new location from the wizard that appears on GRASS’ startup. This time the procedure finished without an error message, but the new location I’m supposed to have created doesn’t show up in the left portion of the wizard. I’m at a loss, really.

    Thanks for any help you might give!

  10. Can you explain this to me in a not so techy way? I live in an area where rain is scarce, I’d like to find out more about this. Thanks.

  11. hi i’m a undergraduate student from korea.
    it was very impressive that you created
    isohyetal lines in qgis, which i have to do now…
    i hope you dont mind giving me some help.
    my problem is that i couldnt input my datas.
    the type of my datas is discrete point with
    x grid, y grid, elevation, and precipitation.
    as far as i know, qgis allow users to plugin datas through ‘delimited text’ tool.
    i tried it, but i failed.
    it kept saying ‘layer is not valid’.
    is there any specific and required way to type datas in text file?
    or what is your suggestion to draw isohyetal map in this situation?

    thank you for reading
    please mail me if you dont mind

    rlarudgh@korea.ac.kr

  12. Kim KyungHo :

    hi i’m a undergraduate student from korea.
    it was very impressive that you created
    isohyetal lines in qgis, which i have to do now…
    i hope you dont mind giving me some help.
    my problem is that i couldnt input my datas.
    the type of my datas is discrete point with
    x grid, y grid, elevation, and precipitation.
    as far as i know, qgis allow users to plugin datas through ‘delimited text’ tool.
    i tried it, but i failed.
    it kept saying ‘layer is not valid’.
    is there any specific and required way to type datas in text file?
    or what is your suggestion to draw isohyetal map in this situation?

    thank you for reading
    please mail me if you dont mind

    rlarudgh@korea.ac.kr

    Hello Kim:
    You should be able to import the list of X-Y locations with the delimited text plugin. Make sure that the original file is indeed “comma separated values” . It should be formatted like:

    250000,500000,100,50
    260000,510000,150,75
    ....

    If you have the data in a spreadsheet (like Excel) then you can do “Save As…” and choose file type as CSV.
    Hope that helps, and let me know if you succeed.

    Micha

  13. Cynthia :

    Can you explain this to me in a not so techy way? I live in an area where rain is scarce, I’d like to find out more about this. Thanks.

    Hello Cynthia:
    Rain gauge data is usually at point locations. We bring the point data into QGIS with the Delimited Text plugin. In order to create isohyetal lines we first interpolate between those points to make a grid of estimated rainfall covering the whole region. This is done in GRASS GIS with the tool:
    v.surf.rst
    This tool uses the “Regularized Spline with Tension” interpolation method. Then from that grid we can use the GDAL tool “gdal_contour”, which is built into QGIS to create contour lines which represent lines of equivalent rainfall.

    I don’t know if that’s what you mean by “not so techy”. If you have a more specific question, I’ll try to respond.

  14. This is great, almost what I was looking for. I used Surfer before to plot contours for subsurface contamination. Now I use Ubuntu full time and I was not able to find something similar. I use QGIS as my GIS and always thought that QGIS was able to create topographical maps with a simple table of x, y and z values (which is the same for subsurface contamination) but was never able to find how. What I really want is “something” that takes my X,Y,Z data, asks me what are the location columns (X,Y) and what is my “elevation” column (Z) and out come a vector contour map. Your method, convoluted as it is, works but I found that there were some instructions missing.
    After importing using the Delimited text tool, the layer has to be saved as a shapefile and loaded in QGIS so that GRASS is able to see it.
    GRASS – Create a new GRASS mapset or open an existing one. (As the first line of third paragraph)
    Once the raster contour is created, GRASS needs to export it, as GeoTIFF, otherwise GDAL will not be able to perform the conversion.
    Other than that, it serves my need beautifully.

  15. hi i m student of 1st year in agriculture university
    plz tell me that how i find the area in isohyetal method of precepitation plzzz i m very thankful to u

  16. alina samoon :

    hi i m student of 1st year in agriculture university
    plz tell me that how i find the area in isohyetal method of precepitation plzzz i m very thankful to u

    Hi Alina:
    Can you make your question a bit more clear? What area are you looking for?
    Regards,
    Micha

  17. Hello, My name is theo and i m doing my internship in a weather forecasting company in UK. I have a .csv file with the name of the station,long,lat,precipitation and i want to create a map which could show which are the driest and the wettest places in the region which is covered by the stations, so i want to do some kind of interpolation by using qgis. anybody has a similar case? any manual ? thanks.

  18. Theodoros Gkousarov :

    Hello, My name is theo and i m doing my internship in a weather forecasting company in UK. I have a .csv file with the name of the station,long,lat,precipitation and i want to create a map which could show which are the driest and the wettest places in the region which is covered by the stations, so i want to do some kind of interpolation by using qgis. anybody has a similar case? any manual ? thanks.

    Hi Theo:
    Did you try the steps in the blog post? Where did you get stuck?
    Regards,
    Micha

  19. without GIS softwares how can I draw this map using altitude,latitude,longitude and rainfall data of the basin.

  20. Fwker Negash :

    without GIS softwares how can I draw this map using altitude,latitude,longitude and rainfall data of the basin.

    Well, I wouldn’t know. I try to work out the procedures using GIS tools. I have no idea how you’d go about it without those tools.

  21. Hello Micha, could you explain in greater detail, how to GDALTools by the contours, it is necessary to convert the product of resultande v.surf.rst to any format, and if so how this can be done. Finally I would like to thank the assistance of doubt and apologize for the spelling, because I’m from Brazil and I’m not fluent in English.

  22. Vinicius :

    Hello Micha, could you explain in greater detail, how to GDALTools by the contours, it is necessary to convert the product of resultande v.surf.rst to any format, and if so how this can be done. Finally I would like to thank the assistance of doubt and apologize for the spelling, because I’m from Brazil and I’m not fluent in English.

    Hello Vinicus:
    Your English seems fine…
    Yes, you are correct, you need to convert the GRASS raster, after interpolating the points, to a GeoTiff, for example. I didn’t realize that GRASS native rasters are NOT recognized by GDALTools in QGIS.
    You can convert the GRASS raster to a GeoTiff by running the r.out.gdal module. Then load the new Geotiff raster into QGIS, and try the GDALTools contour command.
    HTH,
    Micha

  23. Muito obrigado Micha Silver, você me ajudou muito,você estará nos agradecimentos do meu trabalho de conclusão de graduação.

  24. Thank you Micha Silver, you helped me a lot, you’re in the acknowledgments of my graduate work completed.

  25. Minganie :
    Thank you for the continued help!
    I had actually read the manual section on GRASS and tried the procedure to set up a new location. However, every time I try through the Quantum interface, the procedure ends with the error message “g_make_location failed” with nothing more helpful than that. I have really no idea what could cause the new location to fail…

    Just came across this: If you have umlauts or accented character(s) in your path to the GRASS location, then this may cause these troubles. Try it in a different path without accented characters.

  26. Hola Micha

    Thanks for the post. My problem is that the interpolation is not confined to the area of interest: the use of the mask did not work for me. I rasterized a polygon shapefile using v.to.rast and then run r.mask before v.surf.IDW. ¿What did I miss?

    Thanks for all the hel`.

    Patricia

  27. After too much fight i was able to do all the steps (although I’m 100% sure how good the mask work) and I got a beutiful Raster in Grass.
    However, when I try to to use the GDAL function “contours” I can’t use the grass rast file.
    Did you did something to export the raster_grid_file out of grass?

  28. Tiago :

    After too much fight i was able to do all the steps (although I’m 100% sure how good the mask work) and I got a beutiful Raster in Grass.
    However, when I try to to use the GDAL function “contours” I can’t use the grass rast file.
    Did you did something to export the raster_grid_file out of grass?

    Hello Tiago:
    The interface and options in QGIS are changing rapidly. I see now that a GRASS raster is not recognized by the GDAL raster tools. So you have two options:
    1- convert the GRASS raster to a GeoTIFF with the r.out.gdal command in the GRASS toolbox, or
    2- Stay in GRASS, and use r.contours to create your contour lines.
    HTH,
    Micha

  29. Wow. Great piece of advice.

    My sincere congratulations: This is probably the best QGIS tutorial i ever saw.

    Thanks a lot

  30. Thank you so very much for the very detail of advising.
    Actually, I was stuck on the conversion in Gdaltool. Its request raster but I can’t find the layer which I ran by v.surf.rst and finally; I use r.out.gdal to convert it to Geotiff with float32 format and back to follow your advice again then finish with very looking good map result.

    Good job,

  31. I’m trying to do something very similar for a work project, interpolating data points within a given area. However, when I try to use the r.mask tool, I get the following error:
    Cannot start module r.mask
    command: r.mask: line 57: exec: g.parser: not found

    Any ideas on how to fix this problem?
    Thanks

  32. Hi Rick:
    Can you fill in more details on what operating system you’re using, what version of GRASS, how did you install QGIS etc…

  33. Hi Micha,

    Thank you for the tips.. I am trying to do the same as what you’ve done using mean rainfall value.. however i have no idea on how to start up the grass. how do you convert to raster and etc.. it’svery confusing to me (I am new to GIS)

    Appreciate your kind help.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>