Category Archives: GIS

Processing Landsat 8 data in GRASS GIS 7: RGB composites and pan sharpening


In our first blog post (“Processing Landsat 8 data in GRASS GIS 7: Import and visualization“) we imported a Landsat 8 scene (covering Raleigh, NC, USA). In this exercise we use Landsat 8 data converted to reflectance with i.landsat.toar as shown in the first posting.

Here we will try color balancing and pan-sharpening, i.e. applying the higher resolution panchromatic channel to the color channels, using i.colors.enhance (former i.landsat.rgb).

1. Landsat 8 – RGB color balancing: natural color composites

After import, the RGB (bands 4,3,2 for Landsat 8) may look initially less exciting than expected.This is easy to fix by a histogram based auto-balancing of the RGB color tables.


To brighten up the RGB composite, we can use the color balancing tool of GRASS GIS 7:


As input, we specify the bands 4, 3, and 2:


Using a “Cropping intensity (upper brightness level)” of 99 (percent), the result look as follows:


For special purposes or under certain atmospheric/ground conditions it may be useful to make use of the functions “Preserve relative colors, adjust brightness only” or “Extend colors to full range of data on each channel” in the “Optional” tab of i.colors.enhance (former i.landsat.rgb).


You will need to experiment since the results depend directly on the image data.

2. Landsat 8 pansharpening

Pansharpening is a technique to merge the higher geometrical pixel resolution of the panchromatic band (Band 8) with the lower resolution color bands (Bands 4, 3, 2).

GRASS GIS 7 offers several methods through the command i.pansharpen.

1) Brovey transform:


This module runs in multi-core mode parallelized. The management of the resolution (i.e., apply the higher resolution of the panchromatic band) is performed automatically.


2. IHS transform

Here we select as above the bands in the i.pansharpen interface but use the “ihs” method.


HINT: If the colors should look odd, then apply i.colors.enhance (former i.landsat.rgb) to the pan-sharpened bands (see above).

Color-adjusted IHS pansharpening (with “Cropping intensity: strength=99”):


Comparison of Landsat 8 RGB composite (39m) and IHS pansharpened RGB composite (15m):

landsat8_rgb432_color_adjusted_zoom landsat8_rgb432_pansharpen_ihs_color_adjusted_zoom

3. PCA transform

Here we select as above the bands in the i.pansharpen interface but use the “pca” method.


Likewise other channels may be merged with i.pansharpen, even when originating from different sensors.

3. Conclusions

Overall, the IHS pansharpening method along with auto-balancing of colors appears to perform very well with Landsat 8.

Edit 2015: See also pansharpening with i.fusion.hpf!

OSGeo-Live 7.0 Released

The OSGeo-Live geospatial software collection version 7.0 has been released, featuring more than sixty open source, standards compliant geospatial desktop applications, web applications and frameworks. A complete installation kit and high-quality sample data in multiple industry standard formats are included. The OSGeo Live will be officially launched at FOSS4G 2013 in Nottingham, UK, 17-21 September, 2013.

Release Highlights

Projects new to this release include:

  • GeoNode — a web-based application and platform for developing geospatial information systems (GIS) and for deploying spatial data infrastructures (SDI)
  • Leaflet — a modern, open source JavaScript library for mobile-friendly interactive maps
  • ncWMS — a Web Map Service (WMS) for geospatial data stored in CF-compliant NetCDF files
  • netCDF dataset — daily maximum temperature and rainfall, worldwide

All geospatial applications on the disc have been updated to their latest stable releases.

About OSGeo-Live

OSGeo-Live is a self-contained bootable DVD, USB flash drive and Virtual Machine based upon Ubuntu Linux (version 12.04 LTS). OSGeo-Live is pre-configured with a wide variety of robust open source geospatial software. All applications can be trialled without installing anything on your computer, simply by booting the computer from a DVD or USB drive, or running in a Virtual Machine environment. Each featured package is accompanied by both a publication quality one page descriptive summary and a short tutorial on how to get started using it.

OSGeo-Live includes:

  • Over sixty quality geospatial Open Source applications installed and pre-configured
  • Free world maps and geodata
  • One page overview and quick start guide for every application
  • Overviews of key OGC standards
  • Translations to multiple languages


Over 160 people have directly helped with OSGeo-Live packaging, documenting and translating, and thousands have been involved in building the packaged software.

Packagers, documenters and translators include:

Activity Workshop, Agustín Dí­ez, Aikaterini Kapsampeli, Alan Beccati, Alan Boudreault, Alessandro Furieri, Alexander Bruy, Alexander Kleshnin, Alexander Muriy, Alexandre Dube, Alexey Ardyakov, Alex Mandel, Amy Gao, Andrea Antonello, Andrea Yanza, Andrey Syrokomskiy, Andry Rustanto, Angelos Tzotsos, Anna Muñoz, Antonio Falciano, Anton Novichikhin, Anton Patrushev, Argyros Argyridis, Ariel Núñez, Assumpció Termens, Astrid Emde, Barry Rowlingson, Benjamin Pross, Brian Hamlin, Bruno Binet, Cameron Shorter, Christophe Tufféry, Christos Iossifidis, Cristhian Pin, Damian Wojsław, Dane Springmeyer, Daniel Kastl, Daria Svidzinska, David Mateos, Denis Rykov, Diego González, Diego Migliavacca, Dimitar Misev, Dmitry Baryshnikov, Dominik Helle, Edgar Soldin, Eike Hinderk Jürrens, Elena Mezzini, Eric Lemoine, Estela Llorente, Etienne Delay, Etienne Dube, Evgeny Nikulin, Fran Boon, François Prunayre, Frank Gasdorf, Frank Warmerdam, Friedjoff Trautwein, Gavin Treadgold, Giuseppe Calamita, Gerald Fenoy, Grigory Rozhentsov, Guy Griffiths, Hamish Bowman, Haruyuki Seki, Henry Addo, Hernan Olivera, Howard Butler, Hyeyeong Choe, Ian Edwards, Ian Turton, Ilya Filippov, Jackie Ng, Jan Drewnak, Jane Lewis, Javier Rodrigo, Javier Sánchez, Jesús Gómez, Jim Klassen, Jing Wang, Jinsongdi Yu, Jody Garnett, Johan Van de Wauw, John Bryant, Jorge Arévalo, Jorge Sanz, José Antonio Canalejo, José Vicente Higón, Judit Mays, Klokan Petr Pridal, Kristof Lange, kuzkok, Lance McKee, Lars Lingner, Luca Delucchi, Lucía Sanjaime, Mage Whopper, Manuel Grizonnet, Marc-André Barbeau, Marco Curreli, Marco Puppin, Marc Torres, Margherita Di Leo, Maria Vakalopoulou, Mario Andino, Mark Leslie, Massimo Di Stefano, Mauricio Miranda, Mauricio Pazos, Maxim Dubinin, Michaël Michaud, Michael Owonibi, Micha Silver, Mike Adair, Milena Nowotarska, M Iqnaul Haq Siregar, Nacho Varela, Nadiia Gorash, Nathaniel V. Kelso, Ned Horning, Nobusuke Iwasaki, Oliver Tonnhofer, Òscar Fonts, Otto Dassau, Pasquale Di Donato, Patric Hafner, Paul Meems, Pavel, Pedro-Juan Ferrer, Pirmin Kalberer, Raf Roset, Ricardo Pinho, Roald de Wit, Roberta Fagandini, Roberto Antolin, Roberto Antolí­n, Roger Veciana, Ruth Schoenbuchner, Samuel Mesa, Scott Penrose, Sergey Grachev, Sergio Baños, Simon Cropper, Simon Pigot, Stefan A. Tzeggai, Stefan Hansen, Stefan Steiniger, Stephan Meissl, Steve Lime, Thierry Badard, Thomas Baschetti, Thomas Gratier, Tom Kralidis, Toshikazu Seto, Trevor Wekel, Valenty González, Vera, Xianfeng Song, Yoichi Kayama, Zhengfan Lin

Sponsoring organisations


4th GRASS GIS Community Sprint: Exciting achievements

The GRASS GIS community is delighted to present the outcome of the 4th Community Sprint that took place in a warm and sunny Prague, Czech Republic, from July 12 to July 18, 2013. The event happened after the Geoinformatics conference at the Czech Technical University in Prague. The Community Sprint was once more a creative gathering of both long-term and new developers, as well as users.
This meeting was held in the light of 30 YEARS OF GRASS GIS!

We wish to cordially thank the Department of Mapping and Cartography, Faculty of Civil Engineering, Czech Technical University in Prague for hosting and technical support. In particular, we gratefully acknowledge our association sponsors OSGeo  and FOSSGIS e.V., and many individual donors: Peter Löwe, Andrea Borruso, Massimo Di Stefano, Alessandro Sarretta, Joshua Campbell, Andreas Neumann, Jon Eiriksson, Luca Casagrande, Karyn O Newcomb, Holger Naumann, Anne Ghisla, Helena Mitasova and Lubos Mitas, Dimitris Tamp, Mark Seibel, Markus Metz, and Tawny Gapinski. These financial contributions were used to cover costs such as meals and to help reducing travelling and accommodation expenses for participants with far arrival who came on own expenses.

Developers and users who joined the event came from various countries like Italy, Czech Republic, Slovak Republic, Poland, Sri Lanka/France, USA and Germany.
The Community Sprint focused on:

  • testing/bugfixing of the upcoming GRASS 7 version,
  • backporting new functionalities to the stable GRASS 6.4 series,
  • testing/bugfixing related to Mac OS X, MS-Windows and Linux,
  • presenting and developing the new Temporal GIS Algebra in GRASS 7,
  • connecting GRASS 7 with the planetary science software ISIS,
  • discussing integration with software, a powerful multidimensional raster processor,
  • creating 3D vector test data for 3D interpolation,
  • discussing vector conflation,
  • discussing Bundle Block Adjustments,
  • presenting the state of image processing in GRASS 7, and discussing its future,
  • improving documentation, with focus on image processing and Temporal GIS Algebra,
  • developing/refactoring and bugfixing several wxGUI’s components,
  • further developing customizable wxGUI Toolboxes concept,
  • improving translation in Polish and Romanian languages,
  • fixing v.krige in GRASS7 and proposing merge with the recently developed v.kriging module,
  • meeting between Google Summer of Code 2013 mentor and students.

A lot of topic oriented discussions happened among small groups of participants: for more detailed information, please visit the Wiki pages at and the related discussion page at

The Geographic Resources Analysis Support System, commonly referred to as GRASS GIS, is an Open Source Geographic Information System providing powerful raster, vector and geospatial processing capabilities in a single integrated software suite. GRASS GIS includes tools for spatial modeling, visualization of raster and vector data, management and analysis of geospatial data, and the processing of satellite and aerial  imagery. It also provides the capability to produce sophisticated presentation graphics and hardcopy maps. GRASS GIS has been translated into about twenty languages and supports a huge array of data formats. It is distributed freely under the terms of the GNU General Public License (GPL). GRASS GIS is an official project of the Open Source Geospatial Foundation (OSGeo).

GRASS GIS Development Team, July 2013

GRASS GIS 6.4.3RC4 released

Fourth (and last) release candidate of GRASS GIS 6.4.3 with improvements and stability fixes
A fourth release candidate of GRASS GIS 6.4.3 is now available.

Source code download:

Binaries download:

To get the GRASS GIS 6.4.3RC4 source code directly from SVN:
 svn checkout

Key improvements of this release include some new functionality (assistance for topologically unclean vector data), fixes in the vector network modules, fixes for the wxPython based portable graphical interface (attribute table management, wxNVIZ, and Cartographic Composer), fixes in the location wizard for Datum transform selection and support for PROJ.4 version 4.8.0, improvements for selecting the Python version to be used, enhanced portability for MS-Windows (native support, fixes in case of missing system DLLs), and more translations (esp. Romanian).

See also our detailed announcement:

First time users should explore the first steps tutorial after installation.

Release candidate management at

Please join us in testing this release candidate for the final release.

Consider to donate pizza or beer for the upcoming GRASS GIS Community Sprint in Prague:
Thanks to all contributors!

Scaling up globally: 30 years of FOSS4G development

Scaling up globally: 30 years of FOSS4G development. Keynote at FOSS4G-CEE 2013, Romania

In my presentation I briefly review 3 decades of Open Source GIS development, from the ’80th to the present.

ArcGIS vs QGIS etc Clipping Contest Rematch revisited

Earlier this Last year, in June, Don Meltz wrote an interesting blog “ArcGIS vs QGIS Clipping Contest Rematch” where he let compete ArcGIS and Quantum GIS in a clipping contest. The benchmark contest data set in question is a 878MB ZIP file ( The blog page gained a lot of comments, even from ESRI since some ArcGIS versions crashed on this test data set.

Find below the various timings compiled from the blog and the comments:

1) Proprietary software

Software Processing time Hardware/Software
ArcGIS 9.3 crash after 1h 9min: ERROR 999999: Error executing function. Invalid Topology [4gb file limit.] Failed to execute (Clip) unknown
ArcGIS 10.0 crash likewise unknown
ArcGIS 10.1 ESRI promise to calculate it in 34 seconds in this updated version (did anyone test?) unknown
GlobalMapper (version?) 30 mins unknown
GlobalMapper v11.02 49 sec Windows XP w/ 3.5GB RAM
Manifold 8 (64bit) 31 min Windows XP64 16 gb. RAM and 2.33 GHz

Note: The two GlobalMapper results are a bit funny, perhaps always minutes?

2) Free and Open Source Software

Software Processing time Hardware/Software
Quantum GIS (version?; Simple features) 4-5 min unknown
GRASS GIS 7 (topological GIS) 5 min Dell PowerEdge 2950 from 2008, Intel Xeon 2.66GHz, 8GB RAM
gvSIG to be done
PostGIS to be done

Notes: Hope volunteers will test this also on gvSIG and PostGIS (and other FOSSGIS)! Please report…

Fourth release candidate of GRASS 6.4.0 now available

A fourth release candidate of GRASS 6.4.0 is now available.

Source code:

To get the RC4 source code from SVN:
svn checkout

An announcement has been drafted at
(all RC news will be merged into the final announcement later)

Key improvements of the GRASS 6.4.0 release include enhanced portability for MS-Windows (native support), hundreds of fixes, the new wxPython based portable graphical interface and much new functionality.

Release candidate management at

We hope to get out binary packages over the next days.

Top ten myths for Open Source in Geospatial

An interesting email thread is ongoing about Top ten myths which try to harm the reputation of Open Source GIS efforts. Michael P. Gerlek edits a Wiki page collecting the top ~10 myths and misperceptions:

Especially striking the Eduardo Kanegae‘s comment:

In 2008 I worked on a project all based on ESRI 9.2 family. At that
point I didn´t know much of ESRI products and had only worked with
foss products. Now I feel more confortable to give an opinion for

# myth monopoly : every only remember the (supposed) 30% esri market
share. Remember there´s also very nice commercial products like Safe
FME, CadCorp, ManiFold, PCI, ERDAS, ENVI and others ( and sometimes
most of these are embed on ESRI packs - eg.: raster support on AG
family )

# sustainability : while every major release of ESRI will force you to
re-develop your customizations, FOSS products keep release more
compatible. Example: a MapServer 3.x developer will use the same
principles and concepts on MapServer 5.x version. But, an ArcIMS
developer had to change its base when upgrading to ArcGIS Server 9.1,
recode for adapting to ArcGIS Server 9.2 API´s and now all this
concepts will change again with 9.3 version.

# maintenance : foss product will run more closer to open standards (
eg.: OGC´s ). So, you change foss parts without re-coding your entire
solution. The cost of training a new human resource on
insert/update/delete geo-feature using ArcObjects/ArcSDE is so much
higher when compared to OGC-SFS, per example.

# support : while on FOSS communities you can have a reply on minutes,
on 'esri forum' you can your topic open for months ( , , ) and NEVER
get a solution. In my sample, we discover a bug on ArcSDE/ArcMap
9.2sp4 but this will certainly NEVER be fixed because sp6 didn´t fixed
and ESRI will probably only look for 9.3 developments for now and on.
Because non-US customers CAN´T contact ESRI directly, we can only keep
suffering with poor local support.

best regards,
Eduardo Kanegae

Not much to add at this point…

OGR vector data tips and tricks

Get vector map extent

You can easily grep the map extent of a vector map (bounding box):

ogrinfo /cdrom/ITALY_GC.SHP ITALY_GC | grep Extent
Extent: (9.299460, 43.787362) – (13.911350, 47.070188)

Merge of two SHAPE files

Merge of two SHAPE files ‘file1.shp’ and ‘file2.shp’ into a new file ‘file_merged.shp’ is performed like this:

ogr2ogr file_merged.shp file1.shp
ogr2ogr -update -append file_merged.shp file2.shp -nln file_merged file2

The second command is opening file_merged.shp in update mode, and trying to find existing layers and append the features being copied. The -nln option sets the name of the layer to be copied to.

Vector map reprojection

We reproject from the source projection (as defined in .prj file) to WGS84/LL:

ogr2ogr vmap0rd_ll.shp -t_srs “EPSG:4326” vmap0rd.shp

If the .prj file is missing, you can use the ‘’ utility to create it if you know the EPSG code: -wkt 4326 > cities.prj

Reproject to current GRASS location projection:

ogr2ogr -t_srs “`g.proj -wf`” polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp

Cut out a piece of a vector map
Use spatial query extents: -spat xmin ymin xmax ymax (W S E N)

ogr2ogr ARC_BZ.shp -spat 10 45 13 47 ARC.shp

Get VMAP0 metadata info:

ogrinfo -ro gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr
ogrinfo -ro gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr | grep bnd
ogrinfo -ro gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr ‘polbnda@bnd(*)_area’
ogrinfo -ro gltp:/vrf/grass0/warmerdam/v0eur/vmaplv0/eurnasia ‘roadl@trans(*)_line’

MAP0: Extract spatial subregion, reproject from NAD83 to WGS84

# coordinate order: W S E N
ogr2ogr -spat 19.95035 -26.94755 29.42989 -17.72624 -t_srs ‘EPSG:4326’ \
polbnda_botswana.shp gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr \


Sample ‘where’ statements (use -sql for PostgreSQL driver):

# -where ‘fac_id in (195,196)’
# -where ‘fac_id = 195’
ogrinfo -ro -where ‘fac_id in (195,196)’ \
gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr ‘polbnda@bnd(*)_area’

VMAP0 examples

Find out the Countries VMAP0 coding:

ogdi_info -u gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr \
-l ‘polbnda@bnd(*)_area’ -f area | grep Botswana

or read the VMAP0 Military specs, page 75

Extract Botswana, reproject on the fly from NAD83 to WGS84, store as SHAPE:

ogr2ogr -t_srs “EPSG:4326” -where “na2 = ‘BC'” polbnda_botswana.shp \
gltp:/vrf/grass0/warmerdam/v0soa/vmaplv0/soamafr ‘polbnda@bnd(*)_area’

Extract Germany, reproject on the fly from NAD83 to WGS84, store as SHAPE:

ogr2ogr -t_srs “EPSG:4326” -where “na2 = ‘GM'” polbnda_germany.shp
gltp:/vrf/grass0/warmerdam/v0eur/vmaplv0/eurnasia ‘polbnda@bnd(*)_area’
ogrinfo -summary polbnda_germany.shp polbnda_germany | grep Extent
# Extent: (5.865639, 47.275776) – (15.039889, 55.055637)
# W S E N

VMAP0 Contour lines for Germany:

ogr2ogr -t_srs “EPSG:4326” -spat 5.865639 47.275776 15.039889 55.055637 \
contour_lines.shp \
gltp:/vrf/grass0/warmerdam/v0eur/vmaplv0/eurnasia ‘contourl@elev(*)_line’

VMAP0 elevation spots (points) for Germany:

ogr2ogr -t_srs “EPSG:4326” -spat 5.865639 47.275776 15.039889 55.055637 \
elevation_spots.shp \
gltp:/vrf/grass0/warmerdam/v0eur/vmaplv0/eurnasia ‘elevp@elev(*)_point’

VMAP0 lakes of Trentino province in Italy:

ogr2ogr -t_srs “EPSG:4326” -where “na2 = ‘IT'” \
-spat 10.340029 45.261888 10.98727 45.98993 \
lakes_italy.shp \
gltp:/vrf/grass0/warmerdam/v0eur/vmaplv0/eurnasia ‘inwatera@hydro(*)_area’

Connect OGR and PostgreSQL/PostGIS

ogrinfo PG:’ user=postgres dbname=ogc_simple’
ogr2ogr out.shape PG:’ user=postgres dbname=ogc_simple’ lake_geom


Convert GRASS 6 vector map to SHAPE (needs GDAL-OGR-GRASS plugin):

# -nln is “new layer name” for the result:
ogr2ogr archsites.shp grassdata/spearfish60/PERMANENT/vector/archsites/head 1 \
-nln archsites

Using WKT files with ogr2ogr

The definition is in ESRI WKT format. If you save it to a text file called out.wkt you can do the following in a translation to reproject input latlong points to this coordinate system:

ogr2ogr -s_srs WGS84 -t_srs ESRI::out.wkt out_dir indatasource

Most comand line options for GDAL/OGR tools that accept a coordinate system will allow you to give the name of a file containing WKT. And if you prefix the filename with ESRI:: the library will interprete the WKT as being ESRI WKT and convert to “standard” format accordingly. The -s_srs switch is assigning a source coordinate system to your input data (in case it didn’t have this properly defined already), and the -t_srs is defining a target coordinate system to reproject to.

TIGER files in OGR

# linear features:
ogr2ogr tiger_lines.shp tgr46081.rt1 CompleteChain

# area features:
export PYTHONPATH=/usr/local/lib/python2.5/site-packages tgr46081.rt1 tiger_area.shp

OGR CSV driver: easily indicate column types

You can now write a little csv help file to indicate the columns types to OGR. It works as follows. Suppose you have a foobar.csv file that looks like this:


Now write a foobar.csvt file like this one:


The driver will then use the types you specified for the csv columns. The types recognized are Integer, Real and String, DateTime, and Date.

Convert KML to CSV (WKT)

First find layers:

ogrinfo -so myfile.kml

Then convert KML to CSV:

ogr2ogr -f CSV out.csv myfile.kml -sql “select *,OGR_GEOM_WKT from myfilelayer”
cat out.csv

Or use the cool online converter: