mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@2345 c8812cc2-4d05-0410-92ff-de0c093fc19c
475 lines
20 KiB
TeX
475 lines
20 KiB
TeX
\documentclass[a4paper,10pt]{article}
|
|
|
|
\usepackage[latin1]{inputenc}
|
|
\usepackage{amsmath}
|
|
\usepackage{amsfonts}
|
|
\usepackage{amssymb}
|
|
\usepackage{graphicx} %for inserting figures
|
|
\usepackage[authoryear,longnamesfirst,round,comma]{natbib}
|
|
\usepackage{longtable}
|
|
\usepackage{colortbl}
|
|
\usepackage{setspace}
|
|
\usepackage{listings}
|
|
\usepackage{color}
|
|
\usepackage{hyperref}
|
|
\hypersetup{backref,colorlinks=true}
|
|
\usepackage{ae,aecompl}
|
|
|
|
%%%%%%%%%%%%%%%%%%%
|
|
% Page Layout
|
|
%%%%%%%%%%%%%%%%%%%
|
|
|
|
\headheight 0.7cm
|
|
\headsep 1.0cm
|
|
\topskip 0.0cm
|
|
|
|
|
|
%%%%%%%%%%%%
|
|
% Set up the margins
|
|
%%%%%%%%%%%%
|
|
\oddsidemargin 0cm
|
|
\leftmargin -2.0cm
|
|
\rightmargin 0.6cm
|
|
\topmargin -2cm
|
|
\textheight 24.0cm %bottom margin is relative to top!
|
|
\textwidth 6.5in
|
|
\fontsize {12}{14} % I think this is superceded by the 12pt in the documentclass
|
|
%\parskip 5.mm
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
% Try to disable hyphenation
|
|
\pretolerance=2000
|
|
\tolerance=3000
|
|
|
|
|
|
%try to use semicolons between in text citations instead of commas
|
|
\bibpunct{(}{)}{;}{(a}{}{}
|
|
%%%%%%%%%%%% set the harvard style used in text
|
|
%\citationmode{default}
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%Preventing figures from appearing on a page by themselves.
|
|
|
|
% LaTeX's figure placement algorithm is quite biased in favour of putting figures on a page by themselves, instead of on the top of a page with some text below it. Often, I find the result aesthetically unappealing (to be polite). Fortunately, the parameters of the algorithm can be changed. The main problem is that LaTeX per default only allows a part of the top of a text-page (70%) to contain figures, and requires at least 20% of a page to be text when text and figures share a page. These parameters should be set to more reasonable values, for example 85% and 10%.
|
|
\renewcommand{\topfraction}{0.85}
|
|
\renewcommand{\textfraction}{0.1}
|
|
|
|
% This helps, but sometimes LaTeX puts a figure on a page by itself, although it would fit perfectly well on the top of a page. This happens when the figure will not fit on the page where it was defined. LaTeX then attempts to put it on a figures-only page before it attempts to put it at the top of the next page. A page may contain figures alone if the figure(s) use at least half the page. To prevent half-empty pages this limit should probably be increased to around 75%.
|
|
\renewcommand{\floatpagefraction}{0.75}
|
|
|
|
% Be careful not to make \floatpagefraction larger than \topfraction, then you risk to produce a figure that can neither go on the top of a text page, nor on a page by itself. If that happens, the figure and all later figures will be postponed until next time a \clearpage is executed (typically at the end of a chapter or the end of the document). This will also happen if a figure is too large to fit on a page.
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
% Title Page
|
|
\title{Building and Installing QGIS}
|
|
\author{Gary Sherman \and Tim Sutton}
|
|
|
|
|
|
%\date{May 2004}
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%Set up page headers
|
|
\usepackage{fancyhdr}
|
|
% \fancyhead[L,R]{\slshape \rightmark}
|
|
\fancyhead[L]{\slshape Building QGIS 0.5}
|
|
%
|
|
% \fancyfoot[L,L]{\slshape}
|
|
% \fancyfoot[C]{\page}
|
|
% \fancyfoot[R,R]{\slshape}
|
|
\pagestyle{fancy}
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%Define our own custom colors
|
|
\definecolor{gray}{rgb}{.5,.5,.5} %rgb values expressed as 0-1 not 0-255!
|
|
\definecolor{lightgray}{rgb}{.9,.9,.9} %rgb values expressed as 0-1 not 0-255!
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%%%%%%%%%%%% START OF DOCUMENT %%%%%%%%%%%%%%%%%%%%
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
\begin{document}
|
|
|
|
% To disable first line indents of paragraphs after the first one
|
|
\setlength{\parindent}{0in}
|
|
|
|
\maketitle
|
|
\tableofcontents
|
|
% Spacing options are:
|
|
% \singlespacing, \onehalfspacing, or \doublespacing
|
|
%\onehalfspacing
|
|
|
|
% \lstset{language=csh}
|
|
% \lstset{commentstyle=\textit}
|
|
%\lstset{frameround=fttt}
|
|
% \lstset{framesep=3mm}
|
|
% \lstset{backgroundcolor=\color[rgb]{.95,.95,.95}}
|
|
%\lstset{frame=shadowbox}
|
|
|
|
\pagenumbering{arabic}
|
|
|
|
\section{Introduction}\label{label_introduction}
|
|
This document briefly describes how to build QGIS 0.5 (\textit{Bandit}) from the source distribution. These instructions are for Linux/Unix and other POSIX systems which have the required build environment.\\
|
|
|
|
%\textsc{NOTE - All of the required packages for SuSE 9.1 are available at }\url{ftp://ftp.lingis.org}\\
|
|
|
|
Installing the Windows version of QGIS is simply a matter of unzipping the WIN32 distribution and creating a shortcut to the application. See the README.WIN32 file for additional information regarding the Windows version of QGIS. At version 0.5, the GRASS plugin is not available in Windows.\\
|
|
|
|
%This document does not contain instructions for building the GRASS plugins. Information on building the GRASS plugin with raster and vector support can be found in the \textit{Building QGIS with GRASS Support} document, available at \url{http://community.qgis.org/grass_plugin}. \\
|
|
|
|
|
|
|
|
The latest version of this document can always be found at \url{http://qgis.org/docs/install.html}.\\
|
|
|
|
QGIS can be installed with three levels of support for data stores:
|
|
\begin{enumerate}
|
|
\item Basic raster and vector support (GDAL and OGR formats)
|
|
\item PostreSQL/GEOS/PostGIS
|
|
\item GRASS raster and vector support
|
|
\end{enumerate}
|
|
|
|
Basic support uses the GDAL/OGR libraries and supports many raster and vector formats. For more information on the available formats, see \url{http://www.remotesensing.org:16080/gdal/formats\_list.html} and \url{http://www.remotesensing.org:16080/gdal/ogr/ogr\_formats.html}.\\
|
|
|
|
PostgreSQL/PostGIS support allows you to store spatial data in a PostgreSQL database. GRASS support provides access to GRASS mapsets. \\
|
|
|
|
\textsc{NOTE - IF YOU PLAN TO BUILD QGIS WITH GRASS SUPPORT, VERSION 1.2.3 OR HIGHER
|
|
OF GDAL MUST BE USED. }\\
|
|
|
|
Each of the requirements are discussed below. Note that the information given below is abstracted from the installation documentation for each of the libraries. See the install information for each library to get detailed instructions. In the documentation below, the file names and versions used are examples.
|
|
\\
|
|
|
|
If you are building QGIS without PostgreSQL or GRASS support, skip to the section on Installing GDAL/OGR.
|
|
\section{Getting QGIS}
|
|
QGIS is available in both source and package format from \url{http://qgis.org}. \\
|
|
|
|
In addition, packages for many Linux distributions are independently maintained in various locations. See
|
|
the \textit{Download} section on \url{http://qgis.org} for the latest information on package locations.\\
|
|
|
|
Packages for most of the software/libraries discussed below can be found for almost all Linux distributions. While it is possible to mix compiling from source and installing packages to meet the requirements for QGIS, sometimes this becomes tricky. Following the steps below will generally ensure a successful installation. If you are using SuSE 9.1, the LinGIS distribution \url{ftp://ftp.lingis.org} is a good choice for installing QGIS and its dependencies.
|
|
|
|
|
|
\section{PostgreSQL}
|
|
QGIS uses the latest features of PostgreSQL. For this reason, version 7.4.x or higher is recommended with QGIS version 0.5. If you choose to add PostgreSQL, you must also install PostGIS and the GEOS library (see below).
|
|
\begin{enumerate}
|
|
\item Download PostgreSQL source from www.postgresql.org
|
|
\item Extract the source
|
|
\begin{verbatim}
|
|
tar -xzf postgresql-7.4.1.tar.gz
|
|
\end{verbatim}
|
|
|
|
\item Change to the source directory
|
|
\begin{verbatim}
|
|
cd postgresql-7.4.1
|
|
\end{verbatim}
|
|
|
|
\item Configure PostgreSQL:
|
|
\begin{verbatim}
|
|
./configure --prefix=/usr/local/pgsql
|
|
\end{verbatim}
|
|
|
|
\item Build
|
|
\begin{verbatim}
|
|
make
|
|
\end{verbatim}
|
|
|
|
\item Install
|
|
\begin{verbatim}
|
|
make install
|
|
\end{verbatim}
|
|
|
|
\item As root, create the postgres user and setup the database (following taken from PostgreSQL INSTALL file with modification)
|
|
\begin{itemize}
|
|
\item Create the postgres user
|
|
\begin{verbatim}
|
|
adduser postgres
|
|
\end{verbatim}
|
|
|
|
\item Create the directory for the PostgreSQL database
|
|
\begin{verbatim}
|
|
mkdir /usr/local/pgsql/data
|
|
\end{verbatim}
|
|
|
|
\item Change ownership of the data directory to the postgres user
|
|
\begin{verbatim}
|
|
chown postgres /usr/local/pgsql/data
|
|
\end{verbatim}
|
|
|
|
\item su to the postgres user (or login as postgres)
|
|
\begin{verbatim}
|
|
su - postgres
|
|
\end{verbatim}
|
|
|
|
\item Change to the PostgreSQL install directory
|
|
\begin{verbatim}
|
|
cd /usr/local/pgsql
|
|
\end{verbatim}
|
|
|
|
\item Initialize the database
|
|
\begin{verbatim}
|
|
./bin/initdb -D /usr/local/pgsql/data
|
|
\end{verbatim}
|
|
|
|
\item Start the PostgreSQL daemon
|
|
\small
|
|
\begin{verbatim}
|
|
./bin/pg_ctl start -o "-i" -D /usr/local/pgsql/data -l /home/postgres/serverlog
|
|
\end{verbatim}
|
|
|
|
\item Create the test database
|
|
|
|
\begin{verbatim}
|
|
./bin/createdb test
|
|
\end{verbatim}
|
|
\normalsize
|
|
\end{itemize}
|
|
\item PostgreSQL should now be running. Logon as the postgres user (or use su - postgres). You should be able to connect to the test database and execute a test query with the following commands:
|
|
|
|
\begin{verbatim}
|
|
psql test
|
|
select version();
|
|
version
|
|
-------------------------------------------------------------------------------------
|
|
PostgreSQL 7.4.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1 (SuSE Linux)
|
|
(1 row)
|
|
|
|
\q
|
|
\end{verbatim}
|
|
|
|
|
|
\item PostgreSQL install is done
|
|
\end{enumerate}
|
|
|
|
\section{GEOS}
|
|
|
|
QGIS uses GEOS to properly fetch features from the database when doing an
|
|
identify or select. You can still view PostGIS layers without GEOS, but you
|
|
will not be able to create a selection or identify a feature.
|
|
|
|
If you choose to proceed without GEOS support, QGIS will warn you each time you load a layer from the database.
|
|
|
|
To install GEOS:
|
|
\begin{enumerate}
|
|
\item Download GEOS source from \url{http://geos.refractions.net}
|
|
\item Untar GEOS
|
|
\begin{verbatim}
|
|
tar -xzf geos-1.0.0.tar.gz
|
|
\end{verbatim}
|
|
\item Change to the GEOS source dir
|
|
\begin{verbatim}
|
|
cd geos-1.0-.0
|
|
\end{verbatim}
|
|
\item Follow the instructions in the GEOS README file to complete the installation. Typically the install goes like this:
|
|
\begin{verbatim}
|
|
./configure
|
|
make
|
|
make install
|
|
\end{verbatim}
|
|
|
|
\end{enumerate}
|
|
|
|
\section{PostGIS}
|
|
|
|
NOTE - You must edit the PostGIS Makefile and make sure that USE\_GEOS=1 is
|
|
set. Also adjust GEOS\_DIR to point to your GEOS installation directory.
|
|
\begin{enumerate}
|
|
\item Download PostGIS source from \url{http://postgis.refractions.net}
|
|
|
|
\item Untar PostGIS into the contrib subdirectory of the postgresql build directory. The contrib subdirectory is located in the directory created in step 3 of the PostgreSQL installation process.
|
|
\item Change to the postgis subdirectory
|
|
\item Edit the Makefile to enable GEOS support (see the note above)
|
|
\item PostGIS provides a manual in the doc/html subdirectory that explains the build process (see the Installation section)
|
|
\item The quick and dirty steps to install PostGIS are:
|
|
\begin{verbatim}
|
|
cd contrib
|
|
gunzip postgis-0.8.0.tar.gz
|
|
tar xvf postgis-0.8.0.tar
|
|
cd postgis-0.8.0
|
|
make
|
|
make install
|
|
createlang plpgsql yourtestdatabase
|
|
psql -d yourtestdatabase -f postgis.sql
|
|
psql -d yourtestdatabase -f spatial_ref_sys.sql
|
|
\end{verbatim}
|
|
\end{enumerate}
|
|
The \textbf{better way} to install PostGIS is to carefully follow the instructions in the PostGIS manual in the doc/html subdirectory or the online manual at \url{http://postgis.refractions.net/docs}
|
|
|
|
\section{GRASS}
|
|
If you want QGIS to support GRASS vector and raster layers, you must build GRASS prior to proceeding.
|
|
Follow the directions on the GRASS website carefully to build version 5.7. Additional information and the build instructions can be found at \url{http://grass.itc.it}.\\
|
|
|
|
The GRASS software is available for download at \url{http://grass.itc.it/download.html}.
|
|
|
|
\section{GDAL/OGR}
|
|
The GDAL and OGR libraries provide support for raster and vector data formats. QGIS makes use of both of these libraries (which come bundled in one distribution).
|
|
|
|
Note: A Linux binary of GDAL is available at \url{http://www.remotesensing.org/gdal}. If you choose to install the binary you will also need to download and unpack the source tree since QGIS needs the header files in order to compile.
|
|
|
|
To install GDAL/OGR from source:
|
|
\begin{enumerate}
|
|
\item Download the GDAL distribution from \url{http://www.remotesensing.org/gdal}. You should use version 1.1.9 or higher. Versions prior to 1.1.9 contained a bug that caused problems when a null feature was encountered. If you want to build vector support for GRASS, you must use GDAL 1.2.3.
|
|
|
|
\item Untar the distribution
|
|
\begin{verbatim}
|
|
tar xfvz /../path/../gdal-x.x.x.tar.gz
|
|
\end{verbatim}
|
|
|
|
\item Change to the gdal-x.x.x subdirectory that was created by step 2
|
|
\begin{verbatim}
|
|
cd gdal-x.x.x
|
|
\end{verbatim}
|
|
|
|
\item Configure GDAL
|
|
\begin{verbatim}
|
|
./configure
|
|
\end{verbatim}
|
|
or if you want GRASS support
|
|
\begin{verbatim}
|
|
./configure --with-grass=<full path to grass install>
|
|
\end{verbatim}
|
|
Depending on the GDAL version you are building, it may be necessary to specify --without-ogdi when running configure if you don't have the OGDI libary avaiable on your system.
|
|
|
|
\item Build and install GDAL:
|
|
\begin{verbatim}
|
|
make
|
|
su
|
|
make install
|
|
\end{verbatim}
|
|
|
|
\item In order to run GDAL after installing it is necessary for the shared
|
|
library to be findable. This can often be accomplished by setting
|
|
LD\_LIBRARY\_PATH to include /usr/local/lib. On Linux, you can add
|
|
/usr/local/lib (or whatever path you used for installing GDAL) to
|
|
/etc/ld.so.conf and run ldconfig as root.
|
|
|
|
\item Make sure that gdal-config (found in the bin subdirectory where GDAL was installed) is included in the PATH. If necessary, add the path to gdal-config to the PATH environment variable.
|
|
\begin{verbatim}
|
|
export PATH=/../path/../gdal-config:$PATH
|
|
\end{verbatim}
|
|
|
|
\item Check the install by running:
|
|
\begin{verbatim}
|
|
gdal-config --prefix
|
|
\end{verbatim}
|
|
|
|
\end{enumerate}
|
|
|
|
If you've had problems during the installation, refer to this manual, where the whole process is described with some more detail: \url{http://www.remotesensing.org/gdal/gdal\_building.html}
|
|
|
|
\section{Qt}
|
|
Qt 3.1.2 or higher is required in order to compile QGIS. You may already have Qt on your system. If so, check to see if you have version 3.1.2 or later. You can check the Qt version using the find command:
|
|
\begin{verbatim}
|
|
find ./ -name qglobal.h 2>/dev/null | xargs grep QT_VERSION_STR
|
|
\end{verbatim}
|
|
If you have the locate utility installed you can do the same more quickly using:
|
|
\begin{verbatim}
|
|
locate qglobal.h | xargs grep QT_VERSION_STR
|
|
\end{verbatim}
|
|
In either case the result should look something like this:
|
|
\begin{verbatim}
|
|
#define QT_VERSION_STR "3.3.1"
|
|
\end{verbatim}
|
|
In the example above, Qt 3.3.1 is installed.\\
|
|
|
|
If Qt is not installed, you will have to install the Qt development package for your distribution. If you are not able to install the required Qt packages, you will have to build from source.\\
|
|
|
|
To install Qt from source:
|
|
\begin{enumerate}
|
|
\item Download Qt from \url{http://www.trolltech.com/developer} (choose the Qt/X11 Free Edition)
|
|
\item Unpack the distribution
|
|
\item Follow directions provided in the distribution directory (doc/html/install-x11.html)
|
|
\item Use whatever configure options you like but make sure you include -thread for use with QGIS. You can configure Qt with minimal options:
|
|
\begin{verbatim}
|
|
./configure -thread
|
|
\end{verbatim}
|
|
|
|
\item Complete the installation per the instructions provided in the Qt documentation (see step 3)
|
|
\end{enumerate}
|
|
|
|
\section{Building QGIS}
|
|
|
|
After you have installed the required libraries, you are ready to build QGIS. Download and untar the QGIS distribution and change to the QGIS source directory. You have two options for building and installing QGIS: \textbf{Quick and Dirty} and the \textbf{right way}.
|
|
\subsection{Quick and Dirty}
|
|
If you don't need PostgreSQL support and have installed GDAL ,
|
|
you can configure and build QGIS by changing to the distribution directory
|
|
and typing:
|
|
\begin{verbatim}./configure
|
|
make
|
|
make install
|
|
\end{verbatim}
|
|
The above assumes that the gdal-config program is in your PATH
|
|
See the next section for the full configuration instructions.
|
|
\subsection{Configuring QGIS the Right Way}
|
|
To see the configure options available, change the the QGIS
|
|
directory and enter:
|
|
\begin{verbatim}
|
|
./configure --help
|
|
\end{verbatim}
|
|
Among other options, there are three that are important to
|
|
the success of the build:
|
|
\begin{verbatim}
|
|
--with-qtdir=DIR Qt installation directory default=$QTDIR
|
|
--with-gdal=path/gdal-config Full path to 'gdal-config' script,
|
|
e.g. '--with-gdal=/usr/local/bin/gdal-config'
|
|
--with-pg=path/pg_config PostgreSQL (PostGIS) Support
|
|
(full path to pg_config)
|
|
--with-grass=DIR GRASS Support (full path to GRASS binary package)
|
|
|
|
\end{verbatim}
|
|
|
|
\subsubsection{Qt}
|
|
The configure script will detect Qt, unless it is installed in a
|
|
non-standard location. Setting the QTDIR environment variable will
|
|
make ensure that the detection succeeds. You can also specify the
|
|
path using the --with-qtdir option.
|
|
\subsubsection{GDAL}
|
|
If the gdal-config script is in the PATH, configure will automatically
|
|
detect and configure GDAL support. If not in the path, you can specify
|
|
the full path to gdal-config using the --with-gdal option. For example:
|
|
\begin{verbatim}
|
|
/configure --with-gdal=/usr/mystuff/bin/gdal-config
|
|
\end{verbatim}
|
|
\subsubsection{PostgreSQL}
|
|
If the pg\_config script is in the PATH, configure will automatically
|
|
detect and configure PostgreSQL support. If not, you can use the
|
|
--with-pg option to specify the full path to pg\_config. For example:
|
|
\begin{verbatim}
|
|
./configure --with-pg=/usr/local/psql/bin/pg_config
|
|
\end{verbatim}
|
|
\subsubsection{GRASS}
|
|
To build QGIS with GRASS support you must specify the full path to the installed GRASS binary package:
|
|
\begin{verbatim}
|
|
./configure --with-grass=/usr/local/grass-5.7.0
|
|
\end{verbatim}
|
|
This assumes that GRASS is installed in the default location. Change the path to match the location of your GRASS installation.
|
|
\subsubsection{Example Use of Configure}
|
|
An example of use of configure for building QGIS with all options:
|
|
\begin{verbatim}
|
|
./configure --prefix=/usr/local/qgis \
|
|
--with-gdal=/usr/local/gdal/bin/gdal-config \
|
|
--with-pg=/usr/local/psql/bin/pg_config \
|
|
--with-grass=/usr/local/grass-5.7.0
|
|
\end{verbatim}
|
|
This will configure QGIS to use GDAL, GRASS, and PostgreSQL. QGIS will be
|
|
installed in /usr/local/qgis.
|
|
|
|
If QTDIR is set and gdal-config and pg\_config are both
|
|
in the PATH, there is no need to use the --with-gdal and --with-pg
|
|
options. The configure script will properly detect and configure
|
|
GDAL and PostgreSQL. You must still use the --with-grass option if building with GRASS support.
|
|
\subsubsection{Compiling and Installing QGIS}
|
|
Once properly configured simply issue the following commands:
|
|
\begin{verbatim}
|
|
make
|
|
make install
|
|
\end{verbatim}
|
|
NOTE - As of version 0.1, you can no longer run QGIS from the src directory. You must do a make install and start QGIS from the installed location. In the case of the example above, the QGIS binary resides in the bin subdirectory of the directory specified with the prefix option (/usr/local/qgis/bin).\\
|
|
|
|
For information on using QGIS see the QGIS User Guide.
|
|
|
|
\section{Building Plugins}
|
|
The QGIS source distribution contains a number of "core" plugins. These are built along with QGIS using the instructions above. Additional external plugins are available from the QGIS community website at \url{http://community.qgis.org}. Instructions for building an external plugin can be found at \url{http://wiki.qgis.org/qgiswiki/StepByStepBuildInstructions}. Some external plugins may include instructions on building. If so, follow the instructions provided with the plugin rather than those provided in the wiki.
|
|
\end{document}
|