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.
As approach I chose to apply edge detection algorithms to the satellite images, namely the Sobel filter. To get used to the rather new Python scripting in GRASS GIS, I wrote a Python script to preprocess the images. The Python scripting ability is a great addition to GRASS GIS, since it facilitates considerably the entry point to scripting.

As in my previous approach I used again the near infrared band from Landsat images to distinct water bodies from land.

# The input map
inputMap = "20011130_B.4"
# Make sure the region especially the resolution is correctly set
gcore.run_command("g.region", rast=inputMap)

A loop through the five regions applied the Sobel filter to the subimages. Alternatively it would also possible to use the GRASS GIS i.zc module, that also serves the purpose to detect edges. The results of the Sobel filter and the i.zc module are very similar.

2 comments:

Hey , A very nice and informative article and I am trying to do something similar ie extract the roads from satellite image . I wanted to know the kind of dataset you have used and what is the format used ? Thanks in advance .