Running GIS on Open Source

Document Sample
Running GIS on Open Source Powered By Docstoc
					                                              S O C I A L S C I E N C E , S TAT I S T I C S & M A P P I N G

   Running GIS on
   Open Source
   By Yakov Smotritsky

O         ver the last 10 years, GIS
          (Geographical Information
          Systems) has become an
essential part of a wide range of
computerized applications in a
                                       robust GIS package. It is widely
                                       recognized in the open source
                                       GIS community that GRASS
                                       (Geographical Resources Analysis
                                       Support System) is the largest,
                                                                               “tcltkgrass” and is based on Tcl/
                                                                               Tk scripting language libraries.
                                                                               Working with GRASS here in the
                                                                               ITS Social Science, Statistics &
                                                                               Mapping Group, we were able—
variety of fields, including envi-     most powerful, and most reliable        without significant expertise in Tcl/
ronmental protection, urban and        Free Software GIS project. GRASS        Tk—to expand the main tcltkgrass
regional planning, business plan-      is a raster/vector GIS and contains     menu to include our own subset of
ning, transportation, demographic      over 350 programs and tools that        modules with specific interactive
analysis, military operations, and     can create, manipulate, and store       windows.
optimal location planning.             spatial data.
   The software market has re-             GRASS is well-documented            POSTGRESQL/POSTGIS
sponded to the increased demand        and provides the opportunity for        GRASS has a limited internal
for mapping and geospatial solu-       a person with basic C language          database that is capable of sup-
tions with a diversified set of pro-   programming skills to write and         porting only a single attribute for
prietary GIS packages, such as         link his/her own modules to the         each vector object or raster cell
Arc/Info, ArcView, and ArcIMS          package’s internal “front end”. The     category. For projects with more
(Environmental Systems Research        general structure of these modules      complex data structures, the
Institute, Inc. [ESRI]); MapInfo       permits their use in either an inter-   team of GRASS 5.7 developers has
(MapInfo Corp.); GeoMedia (Inter-      active or command line version.         overcome this internal limitation by
graph); IDRISI (Clark Labs);           The ability to study the code orga-     connecting GRASS to an external
Autodesk GIS (Autodesk); and           nization of existing modules is         database management system such
many others. Simultaneously, the       very helpful and facilitates the cre-   as PostgreSQL (released under the
open source community has been         ation of new modules.                   BSD license by The PostgreSQL
actively developing products to            As with many ongoing proj-          Global Development Group). This
meet practically all the basic needs   ects, the number of options,            approach parallels ESRI’s move to
of GIS users. Moreover, GIS users      flags, and parameters has grown         integrate their own data structures
and developers now have the            quickly, and it has become incon-       with more powerful proprietary
luxury of choosing from a variety of   venient to remain in the command        databases such as Oracle.
open source components to build        line environment (which was the            In general, connecting GIS to
viable applications of their own.      only GRASS option 10 years ago).        a relational database requires an
                                       The development of an interac-          additional software layer. For ESRI
GRASS                                  tive front end was therefore a          products like ArcInfo, ArcView,
The centerpiece of this type of        very useful option. The graphical       and ArcIMS, the functionality for
open source development is a           user interface (GUI) for GRASS is       such a gateway is provided by an

                                               Fall/Winter 2004 • Connect: Information Technology at NYU               17
     ArcSDE server. ArcSDE is known         well. The names of these objects         step is to make it Internet-available
     to work with a variety of different    are: point, line, polygon, multi-        or, even better, web-interactive.
     proprietary databases, including       point, multiline, multipolygon, and      A set of proprietary products can
     Oracle, Informix, IBM DB2, Sybase,     geometrycollections. Our experi-         help achieve this goal, but it is
     and Microsoft SQL Server. In the       mentation with PostGIS 0.8.1             also possible to do it using strictly
     case of a GRASS to PostgreSQL          under PostgreSQL 7.4.2 in the Red        open source tools. The number of
     connection, the “spatially enabled”    Hat Linux environment was suc-           websites that have accomplished
     functionality is provided by the       cessful, though some announced           this goal is growing rapidly and
     PostGIS package developed by           PostGIS capabilities are still under     most are running on Linux/Apache
     Refractions Research Inc. (PostGIS     development. (Note to advanced           platforms. Most systems (as Red
     is released under the GNU General      users: PostGIS 0.8.2 Release has         Hat distribution) already have an
     Public License.)                       an “Optional Experimental Light-         Apache server preinstalled. If not,
         PostGIS    allows     advanced     Weight Geometry (LWGEOM)”                the Apache installation is quite
     topological constructs (cover-         feature that includes four-dimen-        straightforward.
     ages, surfaces, networks) to be        sional geometry.)                           Based on our experience in the
     stored, retrieved, and edited in                                                ITS Social Science, Statistics &
     the PostgreSQL object-relational       GIS ON THE WEB: MAPSERVER                Mapping Group using MapServer,
     database system. PostGIS works         Once a person has developed a            however, the rest of the work
     with purely geometric objects, as      GIS application, the next logical        required to get an application

               Figure 1. This GRASS GIS session displays different raster and vector layers from the Spearfish
                     Database. The Tcl/Tk GUI is used simultaneously with the command line interface.

18   Connect: Information Technology at NYU • Fall/Winter 2004
              Figure 2. GRASS GIS data can be accessed through the Web using the MapServer package.

online can be a bit more com-          • libJPEG: From the International      graphic data viewers for GRASS
plicated. MapServer is an open           JPEG Group.                          GIS may prove to be helpful. The
source development environ-                                                   first is Thuban—an interactive
ment for building spatially enabled        The MapServer site, http://        geographic data viewer (Intevation
Internet applications. It was origi-                          ,
                              offers an       GmbH, GNU General Public
nally developed by the University      abundance of information regarding     Licence). Binding the GDAL library,
of Minnesota (UMN) in coopera-         installation, usage, and program-      Thuban will support the GRASS
tion with the TerraSIP project, a      ming in a MapServer environment.       raster file format.
NASA-sponsored cooperative effort      Our particular interest was directed       The second development is
of UMN and a consortium of land        at the PHP/Mapscript module,           QGIS. It offers support for common
management interests.                  which provides scripting access to     vector and raster formats and
    Before compiling and installing    the MapServer C API using a simple     already has GRASS GIS among its
MapServer, we installed a few sup-     yet powerful PHP language. PHP         plug-ins. The process of making
porting packages:                      can be configured on Red Hat Linux     QGIS work with GRASS is straight-
                                       as a “Server API” in two ways: as      forward. Before starting QGIS, you
• gd: A graphics library for fast      an Apache module, or as a CGI.         must export two GRASS shell local
  image creation.                      Due to some complicated PHP/           environment variables, GISBASE
                                       Mapscript inner coding problems,       and LD_LIBRARY_PATH. GISBASE
• FreeType: A TrueType font            this module will not work if PHP is    provides the full path to the direc-
  engine available from the            configured as an Apache module…        tory where GRASS is installed and
  FreeType Project.                    a piece of knowledge which cost us     LD_LIBRARY_PATH is the path
                                       several days of work to learn.         to the GRASS libraries. QGIS is
• libTIFF: For TIFF/GeoTIFF                                                   actually based on Qt, a multi-
  support.                             NEW DEVELOPMENTS IN                    platform C++ GUI toolkit. QGIS
                                       OPEN SOURCE GIS: THUBAN,               works with PostgreSQL DBMS
• Proj.4: A cartographic pro-          QGIS, AND GRASS SERVER                 through the PostGIS package
  jection library from the US          Two recently developed open            once GEOS library has been
  Geological Survey (USGS).            source tools that can serve as geo-    installed. Fortunately, installing

                                              Fall/Winter 2004 • Connect: Information Technology at NYU              19
                           Figure 3. Quantum GIS (QGIS) can display GRASS data using its plugin.

     GEOS (Geometry Engine—Open             (both from ITC, Trento, Italy)             For more information on open
     Source) is not complicated. (QGIS      described their current efforts to      source GIS development, I recom-
     is released under the GNU General      build a GRASS server on top of          mend Open Source GIS: GRASS GIS
     Public License.)                       GRASS as a client-server system.        Approach, by Markus Neteler and
         And finally, in recent news, the   The challenge they are facing is        Helena Mitasova, Kluwer Academic
     “FLOSS/GRASS Users Conference”         very serious because the original       Publishers.
     was held in Bangkok, Thailand on       GRASS design was oriented for
     September 12-14, 2004. (FLOSS          stand-alone modules and is not
     stands for Free/Libre Open Source      thread safe. If they succeed in their   Yakov Smotritsky is a Technical
     Software). At this conference,         goal, the use of GRASS on the Web       System Analyst in the ITS ACS Social
     Radim Blazek and Luca Nardelli         will be greatly simplified.             Science, Statistics & Mapping Group.

        What is Open Source Software?
        The term open source refers to any freely-distributed software whose source code is intentionally made
        available for people to examine and modify. Popular examples include Linux and Mozilla.

        The Open Source Initiative (OSI) is a “non-profit corporation dedicated to managing and promoting the
        Open Source Definition for the good of the community.” As described on their website, “The basic idea
        behind open source is very simple: When programmers can read, redistribute, and modify the source code
        for a piece of software, the software evolves. People improve it, people adapt it, people fix bugs. And this
        can happen at a speed that, if one is used to the slow pace of conventional software development, seems

        For more information about open source, please visit

20   Connect: Information Technology at NYU • Fall/Winter 2004

Shared By: