Skip to Content
Mapping Hacks
book

Mapping Hacks

by Schuyler Erle, Rich Gibson, Jo Walsh
June 2005
Intermediate to advanced
568 pages
24h 7m
English
O'Reilly Media, Inc.
Content preview from Mapping Hacks
376
|
Chapter 6, Mapping on Your Desktop
#76 Explore the Effects of Global Warming
HACK
The first thing we notice is that the Netherlands almost disappear com-
pletely! Additionally, major cities like London, Copenhagen, and Venice fare
rather poorly. This visualization practically begs our other question: if the
sea level were to rise by 10 meters, how many people might be displaced? To
address this question, we’ll have to redo our analysis to specifically identify
which cells in our DEM raster will be submerged.
Method 2: Applying Raster Algebra
Our second approach will use raster algebra to identify which parts of our
elevation model lie below 10 meters, and hence are at risk of being sub-
merged. Raster algebra is simply any process that derives each cell of a new
output layer by applying a user-specified equation to each corresponding
cell in a set of input layers. The r.mapcalc tool performs this function in
GRASS:
GRASS 5.7.0:~/climate > r.mapcalc 'submerged = if(dem <= 10, 1, null( ))'
100%
GRASS 5.7.0:~/climate > r.colors submerged color=rules
Enter rules, "end" when done, "help" if you need it.
Data range is 1 to 1
> 1 blue
> end
Color table for [submerged] set to rules
Our call to r.mapcalc creates a new layer called submerged, which contains a
value of
1 everywhere dem contains a value less than or equal to 10, and a
null value everywhere else. This gives us a raster layer that consists solely ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

GeoServer Cookbook

GeoServer Cookbook

Stefano Iacovella
Leaflet.js Essentials

Leaflet.js Essentials

Paul Crickard III

Publisher Resources

ISBN: 0596007035Purchase LinkErrata PageOther