
\title{The Amazon Deforestation Monitoring System}
\subtitle{A Large Environmental Database Developed on TerraLib and PostgreSQL}
\author{Freitas, U. M., Ribeiro, V. O., Queiroz, G. R., Petinatti, M. R. and Abreu, E. S.}

\maketitle

\section{Abstract}


Brazil's National Institute for Space Research and the Foundation for
Space Science, Technology and Applications developed a complete
monitoring system, based on TerraLib open source technology\footnote{TerraLib Library: \url{http://terralib.org/}}
(Camara, G., et al., 2000), in order to map and calculate the annual
deforestation rates in the Brazilian Amazon. TerraLib implements the
archiving of geographic vector and raster data, on a variety of
proprietary and non{}-proprietary DBMS, including PostgreSQL. TerraLib
supports methods for image and vector data processing and analysis. A
client application, named TerraAmazon, was developed using C++ and the
free graphic user interface toolkit QT (version 3), which runs on LINUX
or Windows machines. \ The data is managed by PostgreSQL version 8.2,
running on a LINUX Server. The application manages all data work flow,
gathering around 600 satellite images, pre-processing, segmenting and
classifying these images, for further human interpretation and edition,
on a concurrent multi{}-user environment. The database stores
approximately 2 million complex polygons and 20 gigabytes of full
resolution satellite images are added every year, using TerraLib
pyramidal resolution schema. A Web site is provided for visualization
and analysis of full resolution data, using the TerraLib PHP extension and
TerraLib OGC WMS server.

\section{Introduction}

Brazil conducts a large environmental project to monitor deforestation
in the Amazon biome using satellite data. Every year a deforestation
map and the rate of yearly deforestation are produced and made public
over the Internet by Brazil's National Institute for Space Research
(``Instituto Nacional de Pesquisas Espaciais'' {--} INPE). The
Brazilian Amazon biome covers an area of 4.7 million square kilometers.
Given this huge area, the task is very demanding. At every year a
complete coverage of the region by satellite images, with 20 to 30
meters resolution, are acquired, automatically processed and analyzed
by remote sensing specialists.

The final deforestation data product has cartographic precision suitable
for a 1:250,000 scale. This project is named PRODES {--} short for
Legal Amazon Deforestation Project {}- started at the end of the 1980s,
and has evolved from an analog interpretation process to a fully
digital procedure. The current methodology was implemented in 2005 and
its technical features are presented in this paper.


Before the new system became operational, deforestation maps were
produced using SPRING, a free desktop image processing and geographic
information system developed by INPE.\footnote{INPE SPRING project: \url{http://www.dpi.inpe.br/spring}} 
In order to produce the complete deforestation map, 229 independent
databases, each one covering the area of one LANDSAT 5 satellite image
were required. This methodology created a complex environment for
management since each database was transferred from one workstation to
another to be submitted to a specific process, involving dozens of
specialists.


In addition to the complexity of the previous methodology, new
requirements forced the Brazilian government in 2005 to improve the
former methodology. The first new requirement was the need to introduce
multi{}-satellite source, in order to guarantee data availability, even
under a satellite operational interruption. Images from the 20 meter
resolution CBERS (China Brazil Earth Resources Satellite) CCD sensor,
30 meter LANDSAT 5 images and 32 meter DMC (Disaster Monitoring
Constellation) satellites images are now used. Figure \ref{fig:satellite_fig1} shows the
satellite images used for 2005 deforestation mapping. The second
requirement was the need for a fast data delivery, in order to create
conditions to implement government policies to be applied earlier,
before the next period of deforestation.

The use of CBERS images as the primary
data source increases the number of images to 570 and the use of the
previous methodology with independent databases would have created a
yet more complex environment for data management. The solution was to
create a unique corporate database which is suitable for management of
all data operations, in a distributed and concurrent environment.

\begin{figure*}[htb]
   \centering
   \includegraphics[width=0.75\textwidth]{proceedings/ribeiro/fig1.jpg}
   \caption{The 221 CBERS, 223 LANDSAT, and 18 DMC satellite images used in 2005}
   \label{fig:satellite_fig1}
\end{figure*}

The technology selected to achieve the project goals was TerraLib.
TerraLib is an Open Source Library developed by INPE and distributed
under GNU LGPL license.\footnote{TerraLib Library: \url{http://www.terralib.org}} TerraLib implements
the storage of geographic vector and raster data, on a variety of
proprietary and non{}-proprietary Database Management System (DBMS),
including PostgreSQL. TerraLib implements methods for image and vector
data processing and analysis. FUNCATE under contract with INPE
developed the complete suite of computer programs to process all data
and deliver the deforestation maps and annual rate, on a full open
source environment. This suite of programs was named TerraAmazon.

\section{Methodology}

Deforestation and subsequent burnings occur in Amazon during a short
period: the dry season, from July to September. After this season, it
is virtually impossible to deforest, due to the high rates of
precipitation. Based on this fact, the annual deforestation rate is
calculated for the period between August 1\textsuperscript{st} of the
previous year and July 31\textsuperscript{st} of the current year. The
later date coincides with the end of the dry season for most part of
the Amazon. In order to obtain the deforestation rate, images acquired
during the dry season period are analyzed. The annual deforestation
rate is estimated by interpolation, considering that deforestation
occurs linearly during the dry season. In addition, deforested areas
are estimated under regions covered by clouds, considering that the
ratio of deforestation is the same in areas with and without clouds
coverage. Detailed information of this method can be found at INPE's
site.\footnote{Detailed information available online: \url{http://www.inpe.br/prodes}}


TerraAmazon manages all operations required by the deforestation
project, in an interactive, distributed and concurrent environment
using a corporate database. In order to take full advantage of
TerraAmazon, the whole Amazon region is divided into cells and each
cell is manipulated by only one remote sensing specialist at a given
time.

Cells are created by partitioning the project extents using a geographic
grid with 0.25 degrees distance between grid lines. Each remote sensing
specialist can lock one or more cells to process using a long
transactions schema. The expert manipulates one of these cells using
image processing and vector edition tools available in TerraAmazon. The
following steps are applied to each of these cells.


\begin{enumerate}
 \item Import a TIFF image
 \item Register image with reference image and save used control points
 \item Audit image using reference image, and
 \item If image is not approved then repeat from step 2
\item Create shade and ground images
\item If image has cloud coverage above a given threshold then
\begin{enumerate}
 \item Classify image to extract regions with clouds
\item Convert regions to cloud polygons
\end{enumerate}
\item Segment shade and ground images
\item Combine ancillary vectors (previous years deforestation, non
forest, and hydrography polygons), segmentation polygons, and cloud
polygons (if any)
\item Interpret and edit combined vectors to create new deforestation and
cloud polygons
\item Audit resulting polygons. If not approved then return to 8; and
\item Disseminate results.
\end{enumerate}


The image processing tools available in TerraAmazon are: TIFF format
image file import, georeferencing based on control points, color
composition and enhancement, mixing model analysis, segmentation, and
classification.

For vector edition, TerraAmazon include: raster to vector and vector to
raster conversion, vector elements edition that considers snap and
topology, and set operations (union, difference, intersection, and
overlay) operations on geographical features.

Other TerraAmazon tools include visualization and database check\{\}-in
and check\{\}-out procedures.

\section{TerraAmazon Implementation Details}

TerraAmazon is a database client application, developed on top of
TerraLib geographic components library, using Standard C++ programming
language and graphical interface implemented using the free graphic
user interface library QT.\footnote{QT Library: \url{http://trolltech.com}}  TerraAmazon can be
executed on LINUX or MS{}-Windows environments. All data is managed by
the PostgreSQL DBMS\footnote{PostgreSQL DBMS: \url{http//:www.postgresql.org}}, running on a LINUX
server. 


Each of the 0.25 degrees cell is blocked by the remote sensing
specialist in a long term transaction schema, bounded by check{}-in and
check{}-out operations. The cell field is used to clip all available
geographic representations in order to reduce the amount of geographic
elements, guaranteeing manageability of graphic features. For fast
visualization these graphic features are cached in memory and indexed
by a linear R{}-Tree (Guttman, 1984). Figure \ref{fig:cells_fig2} shows a region of Amazon
with cell edges highlighted in green.

\begin{figure*}[htb]
   \centering
   \includegraphics[width=0.8\textwidth]{proceedings/ribeiro/fig2.jpg}
   \caption{Cells (highlighted in green) selected for edition in a small part of Amazon.}
   \label{fig:cells_fig2}
\end{figure*}

TerraAmazon topological restriction operations are used during the
edition of new deforestation areas and clouds. Before a new
deforestation or cloud polygon is stored in the database, TerraAmazon
subtracts from the polygon previous deforestation polygons. Figure \ref{fig:topological_fig3}
shows these steps for a new cloud polygon.
\vspace{0.02in}
\begin{figure}[htb]
   \centering
   \includegraphics[width=1\textwidth]{proceedings/ribeiro/fig3.jpg}
   \caption{TerraAmazon topological restriction applied to a new cloud polygon. The polygon stored in the database is the one presented in (D).}
   \label{fig:topological_fig3}
\end{figure}

The complete set of TerraAmazon tools is composed by:

\begin{enumerate}
\item {
Import of TIFF image;}
\item {
Georeference using polynomial model calculated from control points;}
\item {
Image enhancement and color composition;}
\item {
Mixing model analysis; (Shimabukuro,1987); (Shimabukuro;Smith,1991)}
\item {
Image segmentation using region growing algorithm; (Bins et al., 1996)}
\item {
Labeling of regions;}
\item {
Clustering classification;}
\item {
K{}-means classification;}
\item {
Raster to vector and vector to raster conversion;}
\item {
Graphic interface for vector edition with snap and topological control;}
\item {
Union, difference, intersection, and overlay set operations on graphical
features;}
\item {
Check{}-in and check{}-out procedures using cells index.}
\end{enumerate}

\bigskip


An Internet distribution site is provided, based on a PHP application
running on a LINUX Web Server, powered by Apache. The Web application
was created on top of TerraLib library, using the TerraPHP extension.


The Internet site feature includes:


\begin{enumerate}
\item {
Seamless visualization of full resolution data;}
\item {
Image visualization, using pyramidal resolution;}
\item {
Export of full resolution features, defined by user;}
\item {
Web Map Server {}- WMS {}- access to data;}
\item {
User queries, including deforestation by municipalities and inside
protected areas;}
\item {
Deforestation ranking by municipality;}
\item {
Deforestation indices by cell grid;}
\end{enumerate}

Figure \ref{fig:terraamazon_fig4} shows the Internet dissemination site\footnote{Internet dissemination site: \url{http://www3.funcate.org.br/prodes2}}.

\begin{figure*}[htb]
   \centering
   \includegraphics[width=0.85\textwidth]{proceedings/ribeiro/fig4.jpg}
   \caption{TerraAmazon Internet deforestation data dissemination site.}
   \label{fig:terraamazon_fig4}
\end{figure*}

\section{Deforestation Project Figures}

The following figures demonstrate the huge task made possible by
TerraAmazon:

\begin{itemize}
 \item To create the deforestation map for the period 2004-2005, 221
CBERS images, 223 LANDSAT images and 18 DMC images was used, for
2005-2006, 70 CBERS images and 211 LANDSAT images
\item During the interpretation phase, in 2006, the system was accessed by
up to 20 concurrent users. These users added 213,693 new deforested
polygons and 595,575 new cloud polygons to the database
\item The final database stores 2,380,880 polygons, classified in
different categories. These polygons are complex {}- the largest one
has 69,925 vertices, the average number of vertices is 59 and the
average number of holes per polygon is 7
\item The current volume of data stored in database is 237GB and
includes full resolution images using a multi{}-resolution pyramidal
RLZ compressed schema
\end{itemize}

\section{Conclusion}

TerraAmazon fulfilled the requirements imposed by the Brazilian
Government and has been used since 2005. TerraLib technology is an
option to create a complex GIS system, using only open source software
and made feasible the implementation of TerraAmazon.
In addition, TerraAmazon has been proving to be robust, easy to manage
and reliable in a high demand production multi{}-user environment.

\section{Acknowledgments}

This work was supported by INPE - National Institute for Space
Research. The authors wish to thank the development and user groups at FUNCATE
for their efforts. Their collaboration is really greatly appreciated. 
We are grateful to Dr. Laercio Massaru Namikawa for his support and suggestions.

\bigskip

\section{References}
{
Gutmman, A. R{}-trees a dynamic index structure for spatial searching.
\textit{ACM SIGMOD International Conference on Management of Data},
47{}-57, 1984.}

{
\ [Shimabukuro,Y.E.(1987)] Shade images derived from linear mixing
models of multispectral measurements of forested areas. Ph. D.
Dissertation, Department of Forest and Wood Sciences, Colorado State
University, Fort Collins, Colorado. 274p.}


\bigskip

{
[Shimabukuro,Y.E.;Smith,J.A.(1991)] The leastsquares mixing models to
generate fraction images derived from remote sensing multispectral
data. IEEE Transactions on Geoscience and Remote Sensing, v. 29, n. 1,
p. 16{}- 20}


\bigskip

{
[Bins et al.(1996)] L. Bins, L. M. Fonseca, G. J. Erthal, F. Mitsuo Ii
(1996) Satellite Imagery Segmentation: a Region Growing Approach;Anais
do VIII Simpsio Brasileiro de Sensoriamento Remoto: Salvador}


\bigskip

{
[Camara, G., et al. (2000)] TerraLib: Technology in Support of GIS
Innovation; II Brazilian Symposium on GeoInformatics, GeoInfo2000.
S\~ao Paulo}


\address{Vanildes Ribeiro, Ubirajara Freitas, Gilberto Queiroz, Mario Petinatti, Eric Abreu\\
 FUNCATE - Funda\c{c}\~{a}o de Ci\^{e}ncia, Aplica\c{c}\~{o}es e Tecnologia Espaciais\\
\url{http://www.funcate.org.br}\\
  \email{vanildes AT funcate.org.brg}}
