Showing posts with label GRASS GIS. Show all posts
Showing posts with label GRASS GIS. Show all posts

Saturday, November 26, 2016

Another Hydropower dam: Xekaman 1

Just recently I've found by chance the Xekaman 1 hydropower reservoir on Landsat 8 imagery. Time to put it on the map!

The Xekaman river area recorded on 24th January 2015, just before water storage started

Sunday, November 29, 2015

Raster math in GRASS GIS using numpy

Houay Lamphan Gnai, yet another hydropower plant just started commercial operations recently with a reservoir area of seven square kilometers as reported by local media. Time to put it on OpenStreetMap using up-to-date Landsat 8 imagery and the new GRASS GIS 7 plugin for QGIS 2.12. To get familiar with GRASS GIS' interface to numpy, I've decided to extract the reservoir using numpy.

Houay Lamphan Gnai on Landsat 8 image
Houay Lamphan Gnai on Landsat 8 image taken on the 23rd Oct, 2015

Thursday, August 14, 2014

Web Map Service with PyCairo and Pyramid

From time to time I have the chance to work with PyCairo, the Python bindings to the cairo graphic library. I appreciate this library because it allows to draw graphics primitives so super fast and thus it is very suitable to use it in web projects.
After my trials with GRASS GIS as WMS backend I thought I could create a raster web map service with improved performance by using PyCairo instead of GRASS GIS as renderer.

Zoom in - it is a super fast WMS!

Thursday, December 19, 2013

GRASS GIS Web Map Service with Pyramid

Lately I explored the capabilities of the Python bindings in GRASS GIS. Since I'm quite familiar with Python web frameworks it was an easy task to wrap the d.mon module and create a Web Map Service based on a GRASS location.

Here I'll show how I implemented the WMS using the Pyramid framework in a single file.

Wednesday, April 4, 2012

Line extraction with GRASS GIS

This post presents another way how to use Landsat imagery to map features for OpenStreetMap in an easy way with free and open source software only. After remapping the Nam Ngum 1, Nam Leuk reservoir and other lakes using a similar approach, I wanted to improve the Nam Ngum river. The second largest river in Laos and an important tributary to the Mekong was in OpenStreetMap only mapped as a single line instead of an area, although it's more than hundred metre wide downstream of the Nam Ngum 1 reservoir.

Sunday, February 19, 2012

Armchair mapping using GRASS GIS

After reading my previous post a friend asked me why I didn't use just GRASS GIS. That's really a valid question. Since the GDAL/OGR utilities are some of my daily tools, I'm more familiar with them than with GRASS. Out of interest I developed a workflow how to extract and vectorize waterbodies from Landsat images using (almost solely) GRASS GIS. The resulting features I wanted to upload to OpenStreetMap.
This time the Nam Ngum 1 hydro power reservoir in Laos was my test area. Like Nam Leuk last time it was only roughly digitized and some of its islands needed to be remapped.

Wednesday, January 11, 2012

Armchair mapping with Landsat imagery

In this post I want to show step by step how I extracted hydro power reservoirs and lakes in Laos from up-to-date Landsat imagery for further use in OpenStreetMap. The extraction is done straightforward with common GIS tools but without sophisticated and/or proprietary remote-sensing software.
As an example I take the Nam Leuk hydro power reservoir in Laos. This reservoir needs to be remapped, since the origin user declined the upcoming license change. Currently the reservoir is rather roughly generalized.

Sunday, June 26, 2011

Routing with OpenStreetMap data in GRASS GIS

A couple of month ago I got the task to calculate for each village in Switzerland the distance to the intra-Swiss language border. I thought it's a good opportunity to get used to the routing capabilities in GRASS GIS using OpenStreetMap data. Despite following the example of the v.net.path module, I miserably failed. Whatever I tried, I got the warnings
WARNING: Point with category [2] is not reachable from point with category [1]
WARNING: 1 destination(s) unreachable (including points out of threshold)
Finally I solved the task the easy way with v.distance using linear distance.

Now a new GIS task that requires routing came up in our office, and I took this opportunity for a new attempt to create a routable network with OpenStreetMap data in GRASS GIS.
I skipped the conversion from OpenStreetMap data to GIS data in downloading a ready-made road Shapefile from openstreetmap.la and imported it to GRASS GIS. I used the v.net module to connect the start and end points to the network and tried to calculate the shortest path with v.net.path. Again I got the "not reachable" warnings resulting in an empty output map. I checked the topology, everything seemed to be fine, exactly what I expected since OpenStreetMap data are topological. Nevertheless I tried the break operation from v.clean which breaks lines at each intersection:
v.clean input=osm_roads output=osm_roads_cleaned tool=break,rmdupl
And: it does the trick! I got rid of the "not reachable" warnings and was able to calculate the shortest path between two points after building a network with v.net:
echo "1 1 2" | v.net.path -g input=osm_net output=short_dist
In the next step I wanted to calculate the length for each line using v.to.db when I encountered another problem: the length was computed for each original line (before the break up with v.clean) since the segments that were created with v.clean had still the same category. I tried to figure out a "GRASS way" of solving this, but I couldn't. Any help is very appreciated.

Finally I used the following workaround with ogr2ogr, exporting the vector map, dropping the category column and re-import it again in order to get new unique categories for each feature:
ogr2ogr -select "osm_id,highway,oneway,surface,name,name_lo,name_en" -lco ENCODING=UTF-8 tmp.shp $GISDBASE/$LOCATION_NAME/$MAPSET/vector/osm_roads_cleaned/head
Adding the length for each feature with:
v.db.addcol map=osm_net columns='length DOUBLE PRECISION'
v.to.db map=osm_net option=length units=meters columns=length
Now with the correct length for each line it is possible to refine the routing using road speed limits and oneways to get a more lifelike model.

A screenshot using only distance: