# Harvesting pixels using GRASS GIS

having a binary raster map of pixels of interest, a road network, and a target point, my goal is to get a raster map with network pixels having as value the number of pixels of interest they allow to reach.

Would you know how i could use GRASS GIS tools to perform this?

The steps i foresee are:

• rasterize the network usingv.to.rast
• compute pixels of interest distance to the network usingr.grow.distance,
• compute a direction map withr.cost,
• add the target point to the network withv.net operation=connect,
• alter network lines directions toward the target,
• rasterize the network again usingv.to.rast use=dir,
• overwrite the direction map with network direction pixels withr.mapcalc,
• build a directed graph from direction map,
• set a value of 1 to nodes that are on pixels of interest,
• perform a graph traversal toward the target, cumulating nodes values.

By now, i still don't know how to revert lines directions or build the graph.

To revert line direction you can go with v.edit and the flip option.

Usingr.watershed -swith cells of interest provided asflowon a distance to network raster map (fromr.grow.distance), i obtained the accumulation map answering our issues.

### The Category Map

The most common type of GIS map, and in many way the most simple is the category map.

A category map allows us to visualise which category each location belongs to. The example below shows sales territories, categorized by dealer. By looking at the legend we can quickly see which sales territories belong to which dealer.

A Category map showing sales territories for Tom, Dick, and Harry

### Let&rsquos Take A Look Under the Hood

A common misconception for those new to GIS, is that maps &mdash like the category map above &mdash are created in the same way that a graphic designer might create an illustration i.e., starting with the outlines and then clicking on each area to change the color based on which dealer it belongs to.

To an extent that is what&rsquos happening, except the GIS is doing the work rather than you. You see a GIS is data driven, and we use rules to dictate the color or appearance of each &ldquofeature&rdquo on the map.

In GIS each location/thing on the map is generically referred to as a &ldquofeature&rdquo. So whether we are mapping States, Walmart outlets or rivers, each individual State, Walmart outlet or river can be referred to as a &ldquofeature&rdquo.

The rules &mdash or &ldquostyles&rdquo as we call them in GIS speak &mdash are based on data. For example our data looks like this:

Territory sales data

Each row in the table represents a feature on the map. So we can tell our GIS that we want all sales territories that belong to Tom to be colored red and our GIS will dutifully oblige.

In future if Tom gains more sales territories, we don&rsquot need to touch the map. We just change the dealer value of a territory to Tom&rsquos name and the map will magically update itself.

## Rendering only a specific fraction of raster values

I have a raster where each pixel has a continuous value 0-1. I would like to indicate which 25% (for example) of the area corresponding to the raster contains the highest values i.e. indicate where the top 25% of values are located. Is it possible to do this somehow simply in Layer Properties using QGIS?

If you're willing to try using GRASS-GIS, this operation is simple. GRASS has a module r.quantile for calculating any quantiles of a raster map. The default number of quantiles is four, so you get the first 25%, the first 50% (median value), and the 75% quantile. The output of this module is a list of the quantile values. This list can then be "fed" into an r.reclass statement to get the new reclassed raster with value 1,2,3,4 representing each of the four quantiles. If you want only the top 25%, you then run r.mapcalc on the reclassed raster to get only those pixels.

Here's how it goes from the GRASS command line, assuming I have a raster called srtm30:

The above r.mapcalc expression will set all pixels in the bottom 25 percentile to their original raster values, and all other pixels will be NULL. You can tune this to your needs, of course.

Answered 2 months ago by Micha with 0 upvote

For a layer property method you can try the following:

In the symbology of your raster set render type to Singleband pseudocolor . Use mode Quantile . Change the number of classes to 4. Now make the lower 3 classes transparent by going into the colour settings and turning the opacity to 0%.

## REFERENCES

• Ehlschlaeger, C. (1989). Using the A T Search Algorithm to Develop Hydrologic Models from Digital Elevation Data, Proceedings of International Geographic Information Systems (IGIS) Symposium '89, pp 275-281 (Baltimore, MD, 18-19 March 1989). URL: http://faculty.wiu.edu/CR-Ehlschlaeger2/older/IGIS/paper.html
• Holmgren, P. (1994). Multiple flow direction algorithms for runoff modelling in grid based elevation models: An empirical evaluation.Hydrological Processes Vol 8(4), pp 327-334. DOI: 10.1002/hyp.3360080405
• Montgomery, D.R., Foufoula-Georgiou, E. (1993). Channel network source representation using digital elevation models.Water Resources Research Vol 29(12), pp 3925-3934.

## 3 ਏundamental Concepts

We begin by reviewing some basic concepts, and then gradually develop some more advanced concepts.

In high school you learned about coordinate systems. Examples include rectangular Cartesian coordinates, 2D polar coordinates, spherical polar coordinates, et cetera.

In cartography and geodesy, the most common coordinate system is spherical polar coordinates: latitude, longitude, and elevation.

In cartography and geodesy, the origin of latitude is conventionally the equator. The origin of longitude is usually within 100 meters or so of the Greenwich prime meridian. The choice will always involve tradeoffs and a certain amount of arbitrariness, because of various historical accidents and because of continental drift.

For some purposes it is best to measure elevation relative to the center of the earth, but more commonly it is convenient to measure it relative to some geoid. The geoid represents some notion of “mean sea level” at each point on the globe. The geoid is meant to be a gravitational isopotential surface.

In cartography and geodesy, the datum generally includes the choice of geoid, which is logical since the geoid defines the origin for elevation.

• A reference frame (including coordinate system and datum).
• A choice of units of measurement (e.g. degrees, radians, meters, or whatever).
• A choice of cartographic projection.

Note the following contrast:

Meanwhile, there is another very different, very important contrast to be made: A GIS package has both a back-end (for storing data and doing computations) and a front-end (for making maps and displaying them to humans).

You don’t want to run around reprojecting raster data back and forth unnecessarily, because it is computationally expensive and smudges the data a little bit.

## Conclusion

With a little preparation, it is well within the capabilities of a free GIS tool to combine the information available on mission 080103 to construct a reasonable search area that fits it in an operationally reasonable way. The area it pinpoints is small enough to justify tossing a small number of resources there even if "common knowledge" overwhemlingly pushes the search into what is considered more likely areas.

Obviously, using these tools would require that planning section have access to a technical specialist familiar with them. But these tools are freely available and far more powerful than the commercial "mapping programs" that are common in SAR base. I highly recommend that SAR managers cultivate a pool of GIS-savvy volunteers to assist with planning.

## A working environment for digital planetary data processing and mapping using ISIS and GRASS GIS

Since the beginning of planetary exploration, mapping has been fundamental to summarize observations returned by scientific missions. Sensor-based mapping has been used to highlight specific features from the planetary surfaces by means of processing. Interpretative mapping makes use of instrumental observations to produce thematic maps that summarize observations of actual data into a specific theme. Geologic maps, for example, are thematic interpretative maps that focus on the representation of materials and processes and their relative timing. The advancements in technology of the last 30 years have allowed us to develop specialized systems where the mapping process can be made entirely in the digital domain. The spread of networked computers on a global scale allowed the rapid propagation of software and digital data such that every researcher can now access digital mapping facilities on his desktop.

The efforts to maintain planetary missions data accessible to the scientific community have led to the creation of standardized digital archives that facilitate the access to different datasets by software capable of processing these data from the raw level to the map projected one.

Geographic Information Systems (GIS) have been developed to optimize the storage, the analysis, and the retrieval of spatially referenced Earth based environmental geodata since the last decade these computer programs have become popular among the planetary science community, and recent mission data start to be distributed in formats compatible with these systems.

Among all the systems developed for the analysis of planetary and spatially referenced data, we have created a working environment combining two software suites that have similar characteristics in their modular design, their development history, their policy of distribution and their support system. The first, the Integrated Software for Imagers and Spectrometers (ISIS) developed by the United States Geological Survey, represents the state of the art for processing planetary remote sensing data, from the raw unprocessed state to the map projected product. The second, the Geographic Resources Analysis Support System (GRASS) is a Geographic Information System developed by an international team of developers, and one of the core projects promoted by the Open Source Geospatial Foundation (OSGeo). We have worked on enabling the combined use of these software systems throughout the set-up of a common user interface, the unification of the cartographic reference system nomenclature and the minimization of data conversion. Both software packages are distributed with free open source licenses, as well as the source code, scripts and configuration files hereafter presented. In this paper we describe our work done to merge these working environments into a common one, where the user benefits from functionalities of both systems without the need to switch or transfer data from one software suite to the other one. Thereafter we provide an example of its usage in the handling of planetary data and the crafting of a digital geologic map.

### Research highlights

► ISIS allows to process planetary imagers and spectrometers data. ► GRASS GIS allows to process geodata and to produce thematic digital maps. ► We developed computer code and scripts to allow the combined use of ISIS and GRASS. ► We crafted a digital geologic map starting from mosaics, topography and raw data. ► Digital geologic maps produced can be published in interoperable data formats.

## Presentations

### GRASS GIS: What's New?

• Description: GRASS GIS is a geospatial analysis and remote sensing software aiming at providing its users with an all-in-one tool. GRASS GIS is open source which makes it both free to use but also, for the more adventurous, hackable. This talk will give an overview of what the GRASS GIS community provides to the public and will highlight the latest additions to GRASS GIS. These include improvements in import and handling of vector data formats including messy datasets, extended Python capabilities, and easier native data manipulation. Algorithms for interpolation, solar radiation, water flow, and sediment transport now come in parallelized versions, while all raster operations now benefit from new compression algorithms. List of new algorithms includes point clustering, vector topology cleaning, turn support for network analysis, landform and shape detection, image segmentation and clumping, atmospheric corrections for more satellites, and temporal algebra. Experimental features available for download now include concave hull, vector algebra, ground point cloud classification, DEM fusion and blending, object-based classification, Sentinel data handling, and sky-view factor visualization.
• Speaker: Vaclav Petras, NCSU Center for Geospatial Analytics
• Authors: Vaclav Petras, Doug Newcomb (USFWS), Corey White (NCSU Center for Geospatial Analytics)
• Materials: Slides

### GRASS GIS: Getting Started

• Description: GRASS GIS is a software for geospatial analysis and remote sensing. It comes with features covering broad spectrum of topics from network analysis to surface hydrology. In many ways, GRASS GIS is similar to other GIS packages, but it also comes with several unique concepts such as computational region, integrated command line, locations and mapsets. These come with advantages praised by advanced users, but at the same time, these concepts often feel unfamiliar to those accustomed to other GIS software. Nevertheless, for over 30 years now, GIS and RS analysts had reasons to learn GRASS GIS often on their own. Reasons include the breadth of functionality, long-term compatibility and the open source nature of GRASS GIS. For GRASS GIS, being open source means more than just escape from recurring license fees. The GRASS GIS development is characterized by high involvement of interested users in the development process hand-in-hand with programmers and scientists. This session aims at providing basis for self-learning GRASS GIS and will be useful whether you have already tried running GRASS GIS or whether you are just checking it out.
• Speaker: Vaclav Petras, NCSU Center for Geospatial Analytics
• Authors: Vaclav Petras, Corey White (NCSU Center for Geospatial Analytics), Doug Newcomb (USFWS)
• Materials: Slides

### Navigating the Geospatial Open Source Software Landscape

• Description: Does open source mean for free? Is it free, libre, or open source? Can I use it commercially? What software to choose? Where to start learning about geospatial open source software? Do I have to use Linux? Do I have to share my data online? Do I have to start programing? If you are wondering about any of these questions or you are just curious about open source software in general, this talk is for you. This talk will help you understand the geospatial open source software ecosystem and community and additionally, it will provide an overview of available tools and give hints on how to choose between them.
• Speaker: Vaclav Petras, NCSU Center for Geospatial Analytics
• Authors: Vaclav Petras, Corey White (NCSU Center for Geospatial Analytics), Randal Hale (North River Geographic Systems, Inc)
• Relevance to GRASS GIS: GRASS GIS was used in examples of tickets, commits, and other open source concepts. It was also included in overviews of available software.
• Materials: Slides

### Construction of Landscape Level QL2 LiDAR Data Sets for Species Habitat Assessment in Eastern North Carolina

• Description: In response to Hurricane Matthew, the State of North Carolina partnered with USGS to undertake a LiDARdata collection updated to 3DEP QL2 standards. This data collection effort has so far generated 360 billionpoints of multiple return LiDAR data in 59 counties in eastern North Carolina. Using native 64-bit GRASSGIS on Ubuntu Linux, forest canopy heights and other structural metrics were generated on a 6.096m (20foot) grid from county LAZ LiDAR datasets and aggregated to 3.5 billion pixel raster layers denotingcanopy heights, point Z value skewness, relative point density at 1-3m and 3-7m, and building footprints.These data layers were compared to 25m buffered point observations of bird species of interest to theUSFWS in eastern North Carolina, 12 digit USGS Hydrologic Unit (HU) polygons, and the 30m resolution2011 National Landcover Dataset (NLCD). Vegetation structure differences between bird species werenoted, as well as geographic differences in structure for Red-cockaded woodpecker (Picoides borealis) ineastern North Carolina. Aggregate vegetation and building statistics were generated for the 12-digitHydrologic Units (HU) for use in aquatic species habitat assessment. Summary statistics for percentagesof Forest, Non-forest, and Building area for each 2011 NLCD class for eastern North Carolina weregenerated to show the level of agreement between NLCD and the LiDAR data classification.
• Speaker: Doug Newcomb (USFWS)
• Authors: Doug Newcomb (USFWS), Vaclav Petras (NCSU Center for Geospatial Analytics)

### New Open Source Tool for Plant Pest and Pathogen Spread Modeling

Plant diseases and pests directly threaten food production and production of plant-based materials and can also influence agricultural and industrial trade in an area after establishment of necessary quarantine zones. Understanding the potential spread of pests and pathogens is thus crucial for protecting the economy and food security. We present a new software for modeling the spread of pests and pathogens over a landscape. The core of the model is implemented as a C++ library for performance reasons, while the model users can choose from a variety of convenient interfaces. We provide an R package and a GRASS GIS module. The R package provides integration with the well-know statistical tool R and the GRASS GIS provides the module with graphical user interface, Python interface, and preprocessing and visualization tools. The model as well as all its dependencies and integrations are open source. This removes any licensing barriers for application of the model and gives us an opportunity to openly collaborate on improving the model. It also opens opportunities for the model to be scrutinized not only by the traditional peer-review of scientific publications, but also by a review performed by anybody who is interested in using the model.

• Speaker: Vaclav Petras, NCSU Center for Geospatial Analytics
• Authors: Vaclav Petras, Chris Jones, Anna Petrasova, Devon Gaydos, Kellyn Montgomery, Ross K. Meentemeyer
• Materials: Slides

### Citizen Science - Processing LiDAR data at Home to compare to the NLCD

• Description: An example of citizen science you can reproduce at home right now. Private citizen processes open data using open source software. Classifications from LiDAR data were processed using GRASS GIS at a computer at home and compared to the NLCD.
• Speaker: Doug Newcomb

### Geo For All: Blending OER, Open Data and FOSS in GIS Education

• Description: Over the last several years there has been both a maturation of open source geospatial software and a convergence of open educational resources (OER) and open data for teaching and learning geographic information science. This presentation will focus on transitioning an introductory GIS course from using proprietary software and expensive texts to an open source GIS course using OER and open data. Open source software such as QGIS, GRASS, and the R statistical programming language will be covered, as will the “Geo For All” initiative by the Open Source Geospatial Foundation (OSGeo). The presentation will also address the ways in which a transition to OER and open source are having a positive impact on student outcomes in GIS education at a small liberal arts college, as well as how the open GIS course is being used to make a push for wider adoption of open educational resources institution-wide.
• Speaker: David Abernathy, Warren Wilson College
• Relevance to GRASS GIS: GRASS GIS is taught through QGIS Processing plugin and also directly in more advanced classes.

### Creating Urbanization Scenarios with the FUTURES Model

Description: Urban growth scenario simulation is a powerful tool for exploring impacts of land use change due to urbanization and its effects on landscape. We present FUTURES (FUTure Urban - Regional Environment Simulation) which is a patch-based, stochastic, multi-level land change modeling framework. This model, which was once closed and inaccessible, is now integrated with an open source geospatial platfrom. We will describe our motivation for releasing this project as open source and the advantages of integrating it with GRASS GIS. Then we will show how GIS professionals can start using this tool to empower planners to make informed decisions. FUTURES model has a graphical user interface, pre-processing tools, and is available across all main operating systems. Besides the model itself, we provide free online tutorials and sample datasets so that the potential users can experiment with the model and explore its potential.

## QGIS Tutorial II: from data to map – preparing data visualisation

In this tutorial I would like to show you, how to create a topographic map and analyse topographical data using freely available SRTM data and QGIS including some data manipulation. This is part one explaining how to get data, remove missing values, explore the relief and changing the color representation of a TIF file obtained by the USGS.

Attention! This is an in-depth tutorial. If you want special information, jump to the desired section:

### Objective

p align=”justify”>A basis for several analytical steps is the surface of the earth. We differentiate therefore surface and the elevation as buidlings, tree cover and other elements create their own surface which is higher than earths elevation. We will visualize a near-elevation model obtained by the Shuttle Radar Topographic Mission in a map.

### Time effort

We need to download some data from the USGS. In most cases I use landcover.org. Just search for the desired location (I often use path and rows which can be calculated and are better to remember) and use SRTM WRS-2 Tiles:

selections for SRTM data from landcover.org

I have used the filled-finished B version of my area. You can download the example dataset directly as well (copyright University of Maryland, but what about a CC-license?!).

On the QGIS site make sure, that you have installed QGIS properly and you have the GRASS plugin enabled:

Enabled GRASS plugin in QGIS (1.8 for Ubuntu)

You can find some hints on how to enable GRASS for QGIS on Mac. On Windows machines it should be easy due to the standalone installer.

### Preparing data

After unzipping the data we should start with the preparation of the data in QGIS / GRASS. You may ask, why I’m not using QGIS only for this topographic map as it has a tool called “Terrain Analysis Plugin” for this. Short answer: data quality. As you have added the raster to your project you may see something like this:

raster dataset with no contrast due to missing values recorded as “-32768”

p align=”justify”>Using the info tool you will see, that the black areas in and outside of the real scene are pixels with the value “-32768” which is the smallest possible value in the unsigned integer 16 value range which is [-32768 , 32768 ]. As it is possible to display 256 different types of grey, all important values can only be shown in prob. ten types of grey. So we need to define this record for a missing value as “null” or “NoData”. If you won’t do that and you will calculate slope you will get broad plaines around your area of interest and you may forget everything that starts with word stats…

Now GRASS comes into play. GRASS has a function called r.null.val which converts numbers to “null”-values. But using GRASS is a pain in the arse first time: You need to define a working area beforehand.

• Go to Plugins->GRASS->New Mapset
• define a folder to store te results and your data
• create a location (in my case Mongolia)
• now define the projection for your GRASS project. I love the UTM zones so I choose EPSG:32648 (WGS 84 UTM Zone 48 N)
• define an area that is of interest to work at: every process is spatially “limited” to that region by default. You may choose Mongolia, if you’re not sure about the coordinates
• choose a mapset name that is user specific and defines somehow your own project

We are nearly ready to clean up our data but as a last step we need to import our SRTM image into the GRASS project. Use Plugins->GRASS->Open GRASS tools and use the Modules List to find the function r.in.gdal. Now choose your SRTM tif-file for the import and choose a name for the imported dataset:

find the r.in.gdal function in the modules

The last preparational step is to change the value “-32768” to “noData”. Therefore search the function r.null.val in the Modules List as we have done it for the import. select your dataset (SRTM for me) and type the value “-32768” as the value that represents “noData”. Don’t forget to restrict the working area to the tif itself by enabling the “region button”: . Now enjoy the first special moment:

contrast enhancement due to image cleaning

### Map: data processing

For the map it is better to have a good visual effect and create some easy consumable information. So an idea is to create a pseudo-3D effect to represent height information. This is called shaded relief and gives you an idea about the shape of mountains, valleys and slopes.
Search for the shaded relief module in the GRASS toolbox and select the processed SRTM dataset as input (don’t forget to restrict the region as done above as well) and a name for your output. Please change parameters to azimuth �” and altitude 󈬝” to increase the visual effect, press run and add the output to the map afterwards. If you see some failure stating that QGIS was unable to open the raster, this ressource on gis.stackexchange solved the problem in my case. At the end open the properties of the shaded relief layer by right click on the layer name and change the global transparency to 50% or a value of your choice. Make sure that the shaded relief layer is above the SRTM layer.

Now you should ask yourself: Where do I get colours for my heights? There is another module in GRASS which creates a color table using some rules. So use the module r.colors.table to create a color table of your choice:

color classified image of height data using GRASS

Last but not least prepare the layer for map creation: change the title in the General tab of the SRTM layer as it serves as a legend item and change the label of classes in the colormap tab in the properties.

## Landslide susceptibility deterministic approach using geographic information systems: application to Breaza town, Romania

The study is a deterministic-based approach on landslide susceptibility. The purpose of the paper is to create quantitative susceptibility maps by joining the one-dimension infinite slope stability model with a raster-based GIS (ILWIS) and taking into account the spatial distribution of input parameters. A landslide-prone area, with relative homogeneous geology and geomorphology, located in the Subcarpathian sector of the Prahova River, Romania, was selected for the study. There are frequent problems caused by active landslides in the studied area, especially in years with heavy precipitation, often causing destruction of houses and roads situated on the slopes (1992, 1997, and 2005). Detailed surveys covering a 7-year period provided the necessary input data on slope parameters, hydrological components, and the geotechnical background. Two simulations were used: one on dry soil conditions and one on fully saturated soil conditions. A third test was based on the level of the groundwater table mapped in summer 2008. Detailed analyses were particularly focused on landslides to compare predicted results with actual results using field measurements. The model is very suitable for use in raster GIS because it can calculate slope instability on a pixel basis, each raster cell being considered individually. The drawback of the model is the highly detailed data of input parameters. Despite this disadvantage, in conclusion, the usefulness of slope stability models on a large-scale basis was emphasized under infinitely high failure plain conditions and lithological homogeneity.

This is a preview of subscription content, access via your institution.

## References

• Gebbert, S., Pebesma, E. (2014). A temporal GIS for field based environmental modeling. Environmental Modelling & Software, 53, 1–12. DOI
• Gebbert, S., Pebesma, E. (2017). The GRASS GIS temporal framework. International Journal of Geographical Information Science 31, 1273-1292. DOI
• Neteler, M., Bowman, M.H., Landa, M. and Metz, M. (2012): GRASS GIS: a multi-purpose Open Source GIS. Environmental Modelling & Software, 31: 124-130 DOI
• Neteler, M., Mitasova, H. (2008): Open Source GIS: A GRASS GIS Approach. Third edition. ed. Springer, New York. Book site

Last changed: 2018-08-20 15:14

Big geodata management and analysis using GRASS GIS Workshop at FOSS4G 2018 by Veronica Andreo, Marco Ciolli, Luca Delucchi and Markus Neteler is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License - Thanks to Vaclav Petras for the style.