Introduction

Groundwater is a natural resource of great economic importance, since it is an essential input for many human activities. Due to the pollution of surface water resources the demand for groundwater is growing every year (Borevsky et al. 2004; Job 2010).

Foster (1987) employs the expression “aquifer pollution vulnerability” to represent the intrinsic characteristics which determine the sensitivity of the groundwater system to being adversely affected by an imposed pollutant load. This author also differentiates pollution vulnerability from pollution risk, because the latter results both from the natural vulnerability of the aquifer and from the pollution load that is, or will be, applied on the subsurface environment as a result of human activity. Consequently, an aquifer may have high vulnerability but no pollution risk, due to the absence of significant pollution loading, and vice versa. National Academy Press (NAP 1993) defines groundwater vulnerability to pollution as the tendency or likelihood for pollutants to reach a specified position in the groundwater system after introduction at some location above the uppermost aquifer.

Given the importance of sustainable aquifer management, groundwater vulnerability assessment and mapping has become a central subject. Groundwater pollution involves many factors, for instance, geological, geomorphological, climatic and biological conditions. Some of these factors are particularly important for vulnerability mapping, such as geological materials, landforms, unsaturated zone, aquifer hydraulic features and land use. Given the complexity of the issue, a number of models are required, with different vulnerability ratings, different statistical methods, process-based methods and overlay and index methods (Shirazi et al. 2012).

The DRASTIC index is one of the methods most widely used to estimate groundwater vulnerability, whether applying the original index developed by Aller et al. (1987) or using modified versions (e.g., Wang et al. 2012; Fijani et al. 2013; Sener and Davraz 2013).

Geographical information systems (GIS) applications are often used to estimate groundwater vulnerability due to the easiness and efficiency to manipulate, analyze and incorporate geographic data, such as geologic and hydrogeological information (Shirazi et al. 2012). Several studies has been developed to assess groundwater vulnerability through GIS using DRASTIC method (Edet 2014; Shirazi et al. 2013; Yin et al. 2013; Saidi et al. 2010) or modified DRASTIC methods (Neshat et al. 2014; Mimi et al. 2012). Some methods were also created to determine the groundwater vulnerability and risk of pollution (Attoui et al. 2014). These studies were mainly performed through GIS commercial software, such as ArcGIS® (Li and Merchant 2013; Sener and Davraz 2013; Mota Pais et al. 2012; Tilahun and Merkel 2010).

The main objective of this work was to create an open source GIS application for assessing groundwater vulnerability to pollution through the DRASTIC index. The DRASTIC index, according to Aller et al. (1987), is composed of eight factors: depth to groundwater (D), net recharge (R), aquifer media (A), soil media (S), topography (T), impact of the vadose zone (I) and hydraulic conductivity (C).

Methodology

Open source GIS software

The QGIS desktop software was used to develop the DRASTIC index application. QGIS was started in 2002 by Gary Sherman (QGIS 2014) and is licensed under a GNU GPL license. QGIS is an open source software, so it respects the Stallman four freedoms (Stallman 2007).

One of the main advantages of QGIS relies on the easiness and quickness of developing new plugins, using Python language (Teodoro and Duarte 2013). QGIS presents its own application programming interfaces (APIs), such as QGIS API, Gdal/OGR API and PyQt4 API that were used to develop this application. These APIs have functions, classes and modules which interact with geographic information.

SEXTANTE library

Several open source libraries were used in this work. One of the most used was SEXTANTE, which is a spatial data processing framework that provides analysis capabilities, spatial analysis and tools to manipulate geographic information into QGIS (SEXTANTE 2013). This framework has the advantage of supporting external applications such as GRASS, SAGA or Orfeo Toolbox. These algorithms can be easily used in QGIS through SEXTANTE which has a single API with several algorithms available for developers. This framework is very relevant due to its simplicity to use and the possibility to integrate with several libraries. SEXTANTE is free and licensed under the GPL2 license. To integrate the SEXTANTE algorithms with the developed application, the Processing package was imported.

GDAL (Geospatial Data Abstraction Library) library was used to open and read raster files. It was necessary to register a driver before using gdal.Open function. Gdal.AllRegister() function was used to register all drivers at once and this works for reading data.

Programming language

Python is an easy, simple, quick and efficient programming language (Python 2014), and is used in a variety of application domains. Python is compared to other powerful languages, such as JAVA, Tcl, Perl, Scheme or Ruby. It runs in Windows, Linux/Unix, OS2, Mac and other operating systems, and is licensed under an open source license.

Plugin development

QGIS plugins developing rules in QGIS 2.0 Dufour are different from the rules of QGIS previous versions. According to QGIS 2.0 official page (QGIS 2014), some steps have to be followed:

  1. 1.

    Idea have an idea of the main purpose of the new plugin.

  2. 2.

    Create files QGIS have a specific structure file that the user has to follow.

  3. 3.

    Write code write the code in the main program.

  4. 4.

    Test some tests have to be done during the developing phase.

  5. 5.

    Publish in the end, the plugin can be distributed through the QGIS official repository or through a personal repository.

The directory structure of a plugin must respect several files: __init__.py is the starting point of the plugin; plugin.py presents the plugin main code and is developed as several scripts. In the scripts, the code contains all the information about the plugin actions and configurations. The form.ui and the form.py can incorporate several programs with different names. The form.ui is related to the feature interface, windows, edit lines, combo boxes, buttons and other interface options. The form.py presents the code associated with form.ui. The developed plugin comprises 21 classes.

DRASTIC index application imports QGIS API (QGIS API 2014), which contains QGIS Core and QGIS Gui modules, PyQt4 API (PyQt4 API 2014), which includes the Core and Gui modules and Numpy API (Numpy API 2013), to use in mathematical operations between raster files. Some libraries were also used, such as GDAL and OGR Simple Feature Library, to manipulate vector information and raster files (GDAL 2013). The described classes and components are presented in Figs. 1 and 2.

Fig. 1
figure 1

Class diagram

Fig. 2
figure 2

Tool components

Interpolation methods

The first DRASTIC index factor, D, depth to groundwater, is obtained from a point shapefile with values related to depth (z). To create the D raster file it was necessary to estimate the pixel values through a spatial interpolation method. The feature graphic interface allows the user to choose between four interpolation methods: (1) inverse distance weighting (IDW); (2) Kriging; (3) cubic spline approximation; and (4) spatial approximation using spline with tension. These interpolation methods were implemented through SEXTANTE algorithms (GRASS or SAGA libraries).

Inverse distance weighting (IDW) method

The IDW interpolation method is a deterministic method where the unknown point values are estimated with a weighted average of the values available at the known points (Bonham-Carter 1994). This algorithm generates a surface from vector point data by inverse distance squared weighting and uses numerical approximation (weighted averaging) techniques.

Kriging

The Kriging method is an optimal interpolator, an estimated geostatistical method which takes into account the spatial characteristics of regionalized variables. It is based on regression against observed z values of surrounding data points. The Kriging function used in this application belongs to SAGA library and includes several parameters. The SAGA module contains several Kriging variants. In this application the Ordinary Kriging Global (Deutsch and Journel 1992) was used. The ordinary Kriging available in SAGA creates two grids, one containing the interpolated values and the other the variance information (Olaya 2004).

Cubic spline approximation

The cubic spline approximation algorithm used belongs to the SAGA library and approximates irregular scalar 2D data in specified points using continuous bivariate cubic spline (Haber et al. 2001). According to Haber et al. (2001), this method intends to approximate the point data while offering optimal approximation order, should be of high visual quality, used for large real-world data sets, and the local data variation and distribution should be taken into account.

The method objective is to fit a surface to scattered data, based on differentiable bivariate cubic splines (Haber et al. 2001).

Spatial approximation using spline with tension

This interpolation method belongs to GRASS and allows generating a spatial approximation and topographic analysis from a given point or isoline dataset, such as contours, in vector format (Mitasova et al. 1995, 2005). It generates a floating point raster using regularized spline with tension (GRASS GIS 2014).

Implementation of the DRASTIC tool

DRASTIC window

The DRASTIC window is composed of a map canvas, a menu bar containing a File menu, the DRASTIC menu and the Help menu, and allows the user to analyze the result and modify the input parameters. The first one is composed of two buttons that allow the user to add a vector or a raster file (Add Vector File and Add Raster File). The DRASTIC menu is composed of eight buttons, one for each factor and DRASTIC as shown in Fig. 3.

Fig. 3
figure 3

Drastic window with File menu and DRASTIC menu

Through the buttons, the user can create a raster file presenting the spatial distribution of the value of each factor according to the respective rating. The last button, DRASTIC, generates the groundwater vulnerability map through the seven raster files previously generated, in accordance with the DRASTIC index expression from Aller et al. (1987). The Help menu (Fig. 4) provides information regarding the groundwater vulnerability controlling factors and information about the application capabilities. All feature interfaces are composed of an input field, an attribute field, a cell size definition, a weight definition, the ratings table and an output directory field. In all factors, the user can modify the ratings in the factor table and add or remove classes. The weight values can also be modified.

Fig. 4
figure 4

Drastic window with Help menu

It was necessary to import some SEXTANTE modules, such as GRASS through v.surf.idw and v.to.rast.attrib (GRASS GIS 2014) and SAGA through reclassifygridvalues (SAGA 2014).

The aquifer media (A), soil media (S) and impact of the vadose zone (I) factors are defined by descriptions so that there are no fixed interval values to assign the ratings. In this case, the application has the possibility of using the base model defined by default and adopted by Aller et al. (1987). Additionally, the users can modify the provided descriptions or introduce their own descriptions. A third option is available through a button (attribute table), created to import the input attribute table. This option is faster than the others (Fig. 5).

Fig. 5
figure 5

Attribute table button

The following subsections describe how the application generates the raster file for each of the groundwater vulnerability factors considered. In the end, the resulting raster is saved in a Geotiff file and reclassified according to the ratings definition. The default weight values defined are presented in Table 1.

Table 1 Parameter weights [according to Aller et al. (1987)] and ratings assigned to factors A, S and I

Depth to groundwater (D)

The D factor contributes to control the distance that pollutants must travel before reaching the aquifer and allows creating a surface map according to depth values measured in the wells. It can be created by two methods: the base method, which allows interpolating data point with the depth to groundwater values into a raster file, and an improvement method, which allows creating a depth to groundwater surface from DEM (digital elevation model). In the first method, two input files are required, the points file with the depth values and a mask file with the study area extension and boundary limits. The last one is a vector dataset and allows defining the final raster extension.

Different interpolation methods to estimate the depth to groundwater map are available and have already been described in “Interpolation methods”.

The improved method comprises the DEM as input raster file. The method intends to create a surface through drainage network segments (rivers or streams). A new surface is generated with values ranging from 0 m to a maximum depth value which can be modified by the user. A distance raster is created from drainage network segments data and a condition is imposed. The user defines a distance to streams or rivers value, and if the distance is smaller than this threshold the depth values are interpolated between 0 m (at river or stream segments) and the maximum depth (in places located at the defined maximum distance). In the remaining area, where the distance to river or stream segments is larger than the defined value, the depth to groundwater matches the maximum value admitted. Figure 6 presents the depth to groundwater (D) interface with the two methods defined as Base and Improvement.

Fig. 6
figure 6

Base and improvement methods depth groundwater parameter

Net recharge (R)

The R factor assumes that the greater the aquifer recharge, the greater is the groundwater vulnerability to pollution. The feature is composed of three methods to determine the recharge map. The user can choose the best method depending on the available information.

The first method estimates net recharge according to a simplified water budget (e.g., Charles et al. 1993; Custódio and Llamas 1996): recharge = precipitation − overland flow-evapotranspiration. In this case, precipitation, overland flow and evapotranspiration data (mm/year), can be defined as input files. The mathematical operation corresponding to the simplified water budget is performed using a numpy library, subtract function.

The second method requires the availability of recharge rates expressed as a percentage of mean annual precipitation data (mm/year). In this case, the user assumes that the spatial variability of precipitation and other factors that control aquifer recharge is not significant and therefore a constant recharge value may be accepted for the entire study region. This type of data may be found in regional hydrogeological studies.

If the spatial variability of precipitation is significant and is essentially controlled by altitude, a third method may be applied. In this case, the spatial distribution of precipitation is calculated through a DEM coupled with a regression model expressing precipitation as a function of altitude. Finally, a regional recharge rate expressed as percentage of annual precipitation is applied.

Aquifer media (A)

The characterization of the A factor is based on the available geological mapping and regards the influence of each geologic material on the groundwater vulnerability to pollution. Basically, this feature reads and analyzes the vector attribute table and creates a new column with the ratings assigned. This column is converted to raster in the end.

Soil media (S)

The S factor comprises the influence of soil thickness and texture on pollution attenuation. The required information is obtained in soil maps and other bibliographical sources. This feature acts identically to the aquifer media feature.

Topography (T)

The T factor concerns the terrain surface slope and its influence on the infiltration of polluted water into the soil. The topography section implements two different methods. If a contour shapefile is available with elevation values, the feature creates the DEM, derives from it the slope and reclassifies according to the defined ratings.

If the user does not have the contour file but already has the DEM (raster file), he specifies it as input file, and the DEM generation step is skipped. As before, the slope is calculated and reclassified.

Impact of the vadose zone (I)

The I factor concerns the way the type of geologic material occurring below the soil layer and above the saturated zone controls the pollutant attenuation. The creation of this feature is also similar to the aquifer media factor.

Hydraulic conductivity (C)

The C factor relies on the fact that the higher the hydraulic conductivity of the aquifer material, the higher is the groundwater vulnerability to pollution. Hydraulic conductivity values are usually obtained from pumping tests and may be introduced by the user in the attribute table of the geological vector file. If the user does not have access to specific hydraulic conductivity values for the region under study, typical values for the prevailing hydrogeological conditions may be adopted.

DRASTIC index

The last feature, the DRASTIC index, corresponds to the final map, which results from the sum of the seven factor maps created before being multiplied by the corresponding weights as defined in Eq. 1, according to Aller et al. (1987):

$${\text{DRASTIC}} = D_{R} \times D_{W} + R_{R} \times R_{W} + A_{R} \times A_{W} + S_{R} \times S_{W} + T_{R} \times T_{W} + I_{R} \times I_{W} + C_{R} \times C_{W}$$
(1)

R and W (in subscript) correspond to the rating and weight for each factor, respectively.

The DRASTIC interface is composed of seven input files corresponding to D, R, A, S, T, I and C raster files, and an output file corresponding to DRASTIC index map. To obtain a map with the colors and intervals defined according to Aller et al. (1987), a new class, based on gdal color relief option, was implemented. This code allows reading a color file (in format clr) with the RGB codes associated with each interval.

Figure 7 shows the application architecture with the inputs and outputs used in the calculation of the DRASTIC index map and the connections between the scripts created.

Fig. 7
figure 7

Application architecture

Case study: Serra da Estrela

This section presents a brief description of the methodology applied in the study conducted in the River Zêzere Basin upstream of Manteigas village (ZBUM), which is located in the Serra da Estrela region (40°19′N, 7°37′W), Central Portugal (Fig. 8), to generate the maps for each DRASTIC factor as well the final DRASTIC index map. This case illustrates how the application is able to handle the assessment of groundwater vulnerability to pollution in a complex hydrogeological system as well as in a context of data scarcity.

Fig. 8
figure 8

River Zêzere Basin Upstream of Manteigas village (ZBUM) study case

Several hydrogeological studies have been carried out in this region during recent years to achieve a better understanding of the water cycle in a mountain environment (e.g., Carreira et al. 2011; Espinha Marques et al. 2011a, b, 2013).

The Serra da Estrela Mountain is located in the Central-Iberian Zone of the Iberian Massif (Ribeiro et al. 2007). The studied drainage basin has a surface area of 28 km2 and elevation ranging from 875 to 1993 m. The main regional geological units are Variscan granitic rocks, Precambrian–Cambrian metasedimentary rocks and Cenozoic sedimentary cover, namely alluvia and glacial deposits. The Serra da Estrela hydrogeological system is rather complex due to the specific climatic, geologic and geomorphologic features which contribute to control the local water cycle (Espinha Marques et al. 2013). The regional water resources are of significant socioeconomic relevance and include high-quality normal groundwater for agricultural and domestic uses as well as for the bottling industry.

The assessment of groundwater vulnerability to pollution by means of the DRASTIC index provides the local authorities an important tool to improve the sustainability of the water resources management in the Serra da Estrela region.

Depth to groundwater (D) map

The D factor map has been generated through the DEM method, as described in “Depth to groundwater (D)”. According to field observations, the water table depth is at least 20 m in hilltop landform areas, during most of the year, whereas it reaches the topographic surface under river and stream valley bottoms. The application applied a condition with the distance to river and stream segments and created the depth surface from elevation model with values ranging from 0 to 20 m. Figure 9 presents the depth to groundwater factor map.

Fig. 9
figure 9

Depth to groundwater factor map

Net recharge (R) map

The R factor map has been generated using the third method described in “Net recharge (R)”. First, the spatial distribution of mean annual precipitation was calculated through a DEM and a regression model from Espinha Marques et al. (2011a, b) was applied. The regression model is y = 0.99x + 542.22, where y stands for mean annual precipitation (in mm) and x stands for altitude (in m). Then, the factor map is generated applying the regional aquifer recharge rate of 15 % calculated by Espinha Marques et al. (2011a, b). The R factor map obtained is shown in Fig. 10.

Fig. 10
figure 10

Net recharge factor map

Aquifer media (A), soil media (S), impact of vadose zone (I) maps

The A, S and I factor maps were generated according to the information from the geological map of Serra da Estrela Natural Park at scale 1/75,000 from Ferreira and Vieira (1999) as well as hydropedological information from Espinha Marques et al. (2007, 2011, 2013).

In the case of the A and the I factor maps, each geological material was rated according to Aller et al. (1987). As for S factor map, the appropriate rating was established according to the soil texture classes presented by Espinha Marques et al. (2007), that is, mostly sandy soils. The input dataset is the geological map shapefile.

In this case study, the attribute table was imported and the rating was assigned manually. Table 1 presents the assigned values.

Topography (T) map

To obtain the DRASTIC topography parameter, a DEM derived from topographic maps of scale 1:25,000 was used. The ratings were defined according to Aller et al. (1987).

Hydraulic conductivity (C) map

Given the unavailability of hydraulic conductivity studies concerning aquifers from the study area, the parameter ratings were established through typical hydraulic conductivity values (e.g., Freeze and Cherry 1979; Domenico and Schwartz 1990). For fractured igneous and metamorphic rocks, the adopted hydraulic conductivity value was 10−4 cm/s; for glacial deposits the adopted hydraulic conductivity value was 10−2 cm/s. These values were incorporated in the geological map attribute table.

DRASTIC index map

Finally, the groundwater vulnerability to pollution map based on the DRASTIC index (Fig. 11) was created according to the procedure described in “DRASTIC index”.

Fig. 11
figure 11

DRASTIC index map: A example of high vulnerability local, B example of low vulnerability local, C example of moderate vulnerability local

The obtained DRASTIC index map (Fig. 11) allows to clearly differentiate several groundwater vulnerability areas. Most of the study area (19.4 %) is characterized by moderate vulnerability values (120–159). The higher vulnerability values (160–181) correspond to 1.6 % of the area, while the lower vulnerability values (90–119) correspond to 79 %.

The higher vulnerability situations (see for example location A, in Fig. 11) usually correspond to valley bottom landforms where shallower water table, glacial deposits and lower slope values coincide. On the other hand, the lower vulnerability values (see location B in Fig. 11) are present in hillsides, where the water table is deeper and granitic or metamorphic rocks occur along with higher slopes. Location C illustrates an intermediate vulnerability situation.

Conclusions

This application has many advantages to simplify the usage of all the procedures and methods incorporated. The great advantage and improvement of this application is the possibility of modifying the weight values and the ratings of each groundwater vulnerability controlling factor. Besides, the user can modify the description fields or even import the attribute table and assign the ratings.

Another useful application feature is an individual window where the map results are shown and the user can evaluate and analyze the resulting values and generate another map if the results are not the expected. This capacity is possible for all raster maps generated and not just to the final DRASTIC index map; so the user can do a critical result analysis of each one of them. Another essential advantage are the available methods to compute the depth to groundwater and net recharge factors which make it possible to deal with a number of possible situations regarding data availability. This application provides help dialog boxes, providing the needed information about the features and the results obtained; so, it can be helpful to the user due to its simplicity and quickness to produce maps.

The study case in this research was the hydrogeological system located in the River ZBUM village. This system consists, dominantly, of granitic rocks, with subdominant sedimentary rocks and minor occurrences of metamorphic rocks.

In some factors, namely, depth to groundwater, net recharge, topography and hydraulic conductivity, the ratings already defined in the literature were directly adopted. In the remaining factors, the ratings were adapted according to the user personal perception on the system’s hydrogeological conditions. Also, the DRASTIC index was computed adopting the weight values already defined in the literature.

The resulting DRASTIC index map zoning clearly reveals the high spatial variability regarding groundwater vulnerability to pollution as a consequence of the way the hydrogeological system’s features control the distribution of the index factors.

Being developed through open source software makes it easier to obtain and use. The user has the freedom to modify the parameters such as ratings, weights and table description, which allow generating the maps according to his perception regarding each aquifer system. Also the user can modify the code and adapt it (available at (http://www.fc.up.pt/pessoas/amteodor/QGIS/DRASTIC.rar). The advantage of being free allows any user to adopt and improve according to his needs and the available data. The application developed is intended to be useful to the community of hydrologists and of other areas.