Open Source Tools in GIS

5
7193

Do you use a GPS navigator on your phone? Do you use Google Maps to plan a weekend trip? Do you find yourself toying with Google Earth and taking virtual flights?

If you do, then you are already using a Geographic Information Systems (GIS) tool. A GIS would have most of the following features: data acquisition, data storage, data conversion, analysis functions, visualisation and image processing. GIS can serve as a Decision Support System (DSS) in applications ranging from tour planning and city planning, to establishing a worldwide environment policy.

GIS is fascinating as it is data-rich, uses colour-coded visualisation and, most importantly, it represents an aspect of the real world we live in. So let’s get familiar with some of the open source options in data visualisation/editing, spatial databases and spatial file conversion.

Spatial data is the core of any GIS. It could be available in a raster format like GeoTiff, JPEG2000 and DRG, or a vector format like GML, KML, Shapefile, TIGER, GeoJSON, etc.

GRASS (Geographic Resources Analysis Support System) is the leading and most comprehensive open source GIS. It is vast and complex, and is beyond the scope of this article; so I will not cover it here.

Data visualisation and editing

A GIS visualisation and editing tool will allow you to read one or more spatial file formats and let you query and manipulate the data. You can even generate maps with custom colour schemes and labels.

uDig
uDig is a desktop-based GIS built on the Eclipse RCP. It allows you to connect to a WMS (Web Map Service), WFS (Web Feature Service), WCS (Web Coverage Service), spatial database, GeoRSS or Shapefile. It’s best used to generate maps with beautiful colour schemes and to draw new map layers. It’s very easy to install and use.

uDig does not have analysis functions of its own but has a number of plug-ins to beef it up. JGrass interfaces readily with uDig. The JGrass plug-in uses the GRASS algorithms and the uDig user interface to provide hydrological and  geomorphological analysis. uDig supports Common Query Language (CQL) to query spatial vector data.

QGIS
Quantum GIS (QGIS) is another desktop-based GIS that can read most widely used spatial file formats, and allows you to create and edit vector and raster data. QGIS lets you query the attribute table of vector files using the SQL syntax and the result can be visualised or saved as a new spatial data file. QGIS, with the help of the gpsbable tool, allows you to import and view your GPS trails; furthermore, you can generate your own travel maps.

QGIS comes with Python binding and thus provides a Python console for scripting, and has a long list of handy plug-ins. QGIS integrates well with your GRASS installation through the GRASS plug-in. This plug-in allows you to access,edit and run algorithms on the GRASS mapsets.

figure1

figure2figure3

You can georeference an image—for instance, you can georeference a scanned city map by giving at least three reference points in the form of the latitudes, longitude.

QGIS displayed impressive performance while loading large spatial files and rendering maps.

OpenLayers

OpenLayers (OL) is a JavaScript library that allows you to put a dynamic map on a Web page. In short, it helps in building your own Google Maps-like applications. Openstreetmap.org and btis.in (Bangalore Transport Information System) use OL—that’s how mainstream it is. OL takes a map and/or vector data from a WMS or a WFS and displays it on a Web page with features like zoom, pan and layer-select, to list a few. The best thing is that it allows you to add a Google, Yahoo or Worldwind map as a layer so that you don’t necessarily have to run your backend map service. Check out the gallery at openlayers.org/dev/examples to sample all that OL lets you build. OL provides features to add markers, pop-ups, clustering, paging, draw geometries, etc.

Spatial databases

A spatial database supports the geometry datatype and has geometric functions like union, intersect, overlap, buffer, etc. A spatial database can answer a query like ‘Find me all restaurants within 1 km of Forum Mall.’

PostGIS
PostGIS is an OGC (Open Geospatial Consortium) compliant tool that installs as a plug-in on the PostgreSQL object-relational database. The user needs to create a regular database in Postgres, and then run the lwpostsgi.sql script provided in PostGIS to install geometry datatype support and spatial functions on the database. A table named geometry_columns maintains a record of the spatial tables, their respective geometry column, the geometry dimension, etc. PostGIS allows you to create a spatial index on the geometry column to speed up spatial queries. The pgRouting plug-in provides the routing capability. It has implementations of Shortest Path Dijkstra, Shortest Path A*, Shortest Path Shooting Star and Travelling Sales Person algorithms.

As of now, PostGIS is the best open source option for a spatial database. A lot of GIS software use it as a data source. These include QGIS, uDig, GRASS, OpenJUMP, IGIS, GeoServer, MapServer and others.

SpatiaLite
SpatiaLite is an extension to SQLite, an SQL database engine. It conforms to OpenGIS specifications, and also has upport for WKB and WKT formats. The VirtualNetwork module enables SpatiaLite to handle routing through the implementation of the Dijkstra’s Shortest Path algorithm. Spatial indexing is available through SQLite’s RTree extension.

Spatial file conversion

Finding the spatial data you need is a project in itself. Furthermore, you will often find that your GIS won’t be able to handle the file formats your spatial data is available in, considering the number of different file types. For example, OSM XML (openstreetmap XML format) won’t load in uDig, and Google Earth won’t read Shapefiles.

ogr2ogr
ODR is a set of command-line  utilities to read and write spatial vector files. Ogr2ogr, which is a part of the ODR set, is a utility that converts from one spatial file format to another. During the conversion, it allows operations like attribute selections, resetting of the output coordinate system or even reprojection of the features.

This utility can be used to merge several spatial files into a single file with the help of the -append flag. Ogr2ogr can work with the following file formats: shapefile, GML, KML, TIGER, Mapinfo and the PostGIS database, among others.

shp2pgsql
This command line utility converts a Shapefile into SQL, which can later be loaded into a PostGISenabled Postgres database. It has flags to create tables, append to existing tables, output in the WKT format, etc.

osm2pgsql
This is a command-line utility used to directly load an Openstreetmap XMLfile into a PostGIS database. It creates all the tables itself. Once the data is in the database, ogr2ogr could be used to export it in other formats.In certain cases, you may have to do a multi-tier conversion—that is,format A -> B, then B->C. uDig and QGIS read a number of formats and allow you to save in other formats,and hence serve as file conversion tools.

5 COMMENTS

  1. Great article! Do you know of any software that converts from a 3d raster format (the result of a 3d scanning) into a vectorial one? Thanks!

  2. Hi SIlen,
    Thanks, and excuse me for the delayed response. I got a notification for your comment today (4th Dec 2010) :)

    I don’t have experience with 3D Rater data and have no knowledge of the tools to be used.

LEAVE A REPLY

Please enter your comment!
Please enter your name here