root/trunk/INSTALL

Revision 1551, 7.6 kB (checked in by dane, 2 months ago)

update INSTALL docs noting boost 1.41 and icu 1.4 requirements

  • Property svn:keywords set to Id
Line 
1# $Id$
2
3INSTALLATION INSTRUCTIONS
4
5
6Quick Start
7-----------
8
9For platform specific install guides see:
10
11  http://trac.mapnik.org/wiki/MapnikInstallation
12
13Install needed dependencies::
14
15  $ sudo apt-get install libboost* libicu* libfreetype* proj # see below for full list
16  $ cd ~/src/mapnik
17
18Configure the build setup::
19
20  $ python scons/scons.py configure
21
22Build Mapnik source code::
23
24  $ python scons/scons.py
25
26Install Mapnik library and python bindings::
27
28  $ sudo python scons/scons.py install
29
30If on Linux then run:
31
32  $ sudo ldconfig
33
34Run python interpreter and check installation::
35
36  >>> import mapnik
37  Traceback (most recent call last):
38   File "<stdin>", line 1, in <module>
39  ImportError: No module named mapnik
40  >>>
41
42If you get this error ensure that Mapnik in is your PYTHONPATH.
43
44Otherwise your setup is ready. You can now visit http://trac.mapnik.org/wiki/GettingStarted for a basic tutorial.
45
46For help with using SCons see: http://trac.mapnik.org/wiki/UsingScons
47
48For troubleshooting errors see: http://trac.mapnik.org/wiki/InstallationTroubleshooting.
49
50
51Prerequisites
52-------------
53
54First, here is a quick list of the required software dependencies:
55
56- Linux/UNIX with g++ compiler
57- Python 2.2 or greater to build Mapnik
58    - Python 2.4 for python bindings (see below)
59- libboost >= 1.41.0 or greater with the following libraries included:
60    - system
61    - thread
62    - filesystem
63    - regex
64    - iostreams
65    - python - required only for python bindings (see below)
66- libicu >= 1.4- International Components for Unicode
67- libpng - PNG Graphics
68- libjpeg - JPEG Graphics
69- libtiff - TIFF Graphics
70- libz - Compression
71- libfreetype2 - Font support (Install requires freetype-config)
72- libxml2 - XML parsing (Install requires xml2-config)
73- proj - PROJ.4 Projection library
74
75Second, here are the optional software dependencies:
76
77- Python 2.4 or greater for Python language bindings
78- Boost 'python', required for binding Python language bindings
79- Boost 'program_options' for shapeindex executable support
80- Cairo - Graphics library for PDF, PS, and SVG formats
81    - pkg-config - Required for building with cairo support
82    - cairomm - C++ bindings for cairo
83    - pycairo - Python bindings for cairo
84- libpq - PostgreSQL libraries (For PostGIS plugin support)
85- libgdal - GDAL/OGR input (For gdal and ogr plugin support)
86- libsqlite3 - SQLite input (needs RTree support) (sqlite plugin support)
87- libocci - Oracle input plugin support
88- libcurl - OSM input plugin support
89
90If your system does NOT have one of these installed, you will need to install the mandatory ones at the very least before proceeding further.
91
92Instructions for installing many of these dependencies on various platforms can be found at the Mapnik Community Wiki (http://trac.mapnik.org/wiki/MapnikInstallation).
93
94On Linux and Mac OS, package management systems (such as apt for debian or macports for darwin) can be used to install most or all dependencies, but source installs may be preferrable. This is particularly true for libraries that a required for the Python bindings, where source installs may be the best way to ensure that the same python version us linked to Boost, Cairo, and Mapnik.
95
96Note: a minimum of 256MB of RAM is recommended for the build process.
97
98
99Building
100--------
101
102Once you've installed the required software packages, the simplest way to build Mapnik is to run SCons (The software builder) without any options::
103
104  $ cd ~/src/mapnik
105  $ python scons/scons.py configure
106  $ python scons/scons.py # will build sources
107
108This should compile and link the mapnik library as well as the input plugins and the python language binding (if possible).  If any mandatory dependencies are not found the build will fail, and you will need to specify custom paths to your libraries and include files.
109
110SCons accepts a variety of options to customize your build.  This allows you to specify which components are compiled, where to find dependencies, where to install mapnik, and so on.
111
112To see the list of available options, from the root of the source distribution, run::
113
114  $ python scons/scons.py -h
115
116For example, if you compiled your own set of Boost libraries, you might use::
117
118  $ python scons/scons.py configure BOOST_INCLUDES=/usr/local/include/ BOOST_LIBS=/usr/local/lib
119
120Or if you installed ICU from source and you'd like to build Mapnik in Debug mode you might use::
121
122  $ python scons/scons.py configure DEBUG=True ICU_INCLUDES=/usr/local/include ICU_LIBS=/usr/local/lib
123
124For more details on all the options see: http://trac.mapnik.org/wiki/UsingScons
125
126Note: the Python used to run SCons does NOT have to be the same as the one used for the python bindings.
127
128
129Installation
130------------
131
132Once the build has successfully completed, you can install the various files on your system by executing::
133
134  $ sudo python scons/scons.py install
135
136By default, everything will be installed under the PREFIX '/usr/local' as such::
137
138  $PREFIX/lib: libmapnik.so (.dylib on mac os)
139  $PREFIX/lib/mapnik/input: input plug-ins
140  $PREFIX/include: mapnik include files
141  $PREFIX/bin: shapeindex utility
142  $PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages/mapnik: Python bindings
143
144If you're using the default PREFIX, you will most likely need to be root to perform the install.
145
146
147Testing Installation
148--------------------
149
150First, try importing the Mapnik python module in a python interpreter, and make sure it does so without errors::
151
152  $ python
153  Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
154  [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
155  Type "help", "copyright", "credits" or "license" for more information.
156  >>> import mapnik
157  >>>
158
159Then, try rendering the demo map, included in the Mapnik source code::
160
161  $ cd demo/python
162  $ python rundemo.py
163
164If the resulting maps look good, this indicates the core components of Mapnik are installed properly, as well as the Shapefile plugin, Unicode text support (ICU), and re-projection support using Proj.
165
166For further tests see the `tests` folder within the Mapnik source code.
167
168
169Learning Mapnik
170---------------
171
172For Users:
173  - Visit http://trac.mapnik.org/wiki/LearningMapnik for basic tutorials on making maps with Mapnik using the Python bindings.
174
175For Developers:
176  - Visit http://trac.mapnik.org/#DevelopersCorner for resources for getting involved with Mapnik development.
177
178
179Mapnik Community
180----------------
181
182Mapnik has an active community of talented users and developers making amazing maps.
183
184If you are looking for further help on installation or usage and you can't find what you are looking for from searching the users list archives (http://lists.berlios.de/pipermail/mapnik-users/) or the trac wiki (http://trac.mapnik.org/), feel free to join the Mapnik community and introduce yourself.
185
186You can get involved by:
187  - Subscribing to the mapnik-users list: http://lists.berlios.de/mailman/listinfo/mapnik-users
188  - Subscribing to the mapnik-developers list: http://lists.berlios.de/mailman/listinfo/mapnik-devel
189  - Joining the #mapnik channel on irc://irc.freenode.net/mapnik
190  - Signing up as a user or contributer at http://www.ohloh.net/p/mapnik/ 
191
192
193A note on projection support
194----------------------------
195
196Mapnik's core C++ library and map rendering engine support on-the-fly cartographic
197reprojections.
198
199Here is an example on how to use it::
200
201  >>> import mapnik
202  >>> p = mapnik.Projection('+init=epsg:27700') # British National Grid
203  >>> p.forward(mapnik.Coord(-1.125,51.75))
204  Coord(460396.920899,206113.214203) # reprojected coordinate x, y pair
205  >>> p.forward(mapnik.Envelope(-1.125,51.75,-1.0,50.75))
206  Envelope(461721.365661,94917.0749406,469024.861457,206224.090767) # reprojected extent
207
208
209The Projection() instance provides inverse() and forward() methods.  For details on the possible parameters,
210see the PROJ.4 documentation.
Note: See TracBrowser for help on using the browser.