mapnik-win-setup /

Filename Size Date modified Message
47 B
4.0 KB
7.0 KB
577 B
135 B
79 B
Mapnik Windows Kitchen Sink

Basic goals
 * Mapnik + heaps of python tools installed in one go
 * be able to install everything from USB drive, without fussing
   - OSGEO4W can work offline if done right, but requires fussing
 * In future should allow support for multiple python versions
   - Currently only supports Python 2.5, to match standalone QGIS installer

 * Mapnik 0.7.1 / Python 2.5/2.6 bindings
   * NOTE: installer *only* sets up py2.5 bindings
 * osm2pgsql (and libs)
 * proj4 nad files (so mapnik/osm2pgsql can create projections with +init=espg=<code>)
 * PIL (platform specific - py25/26)
 * lxml (platform specific - py25/26)
 * Cascadenik
 * cssutils
 * nik2img (mapnik_utils)
 * TileLite
 * Werkzeug

Building Installer
Basically to set this up we do three things:
  * Downlod mapnik-0.7.1 and unzip in this local directory
  * Stick a bunch of other stuff into the directory structure created by unzipping
  * Then install NSIS and run it to create an .exe installer
    - Compile 'mapnik_nsis_script.nsi' into the standalone installer by right clicking on nsi

Here is a unix shell script to setup the files:

cd mapnik-win-setup
# grab mapnik
# unzip
# above command creates the mapnik-0.7.1 directory which we stash all things in

# get osm2pgsql
# unzip
# copy to binary
mv osm2pgsql/osm2pgsql.exe mapnik-0.7.1/bin/
# copy the libs
mv osm2pgsql/*dll mapnik-0.7.1/lib
# create a data share dir
mkdir mapnik-0.7.1/share
mv osm2pgsql/*style mapnik-0.7.1/share
mv osm2pgsql/*sql mapnik-0.7.1/share
# cleanup
rm -rf osm2pgsql

# proj4
# unzip
# place nad in dir that installer expects
mv proj/nad/ mapnik-0.7.1/
echo '# WGS 84 / Pseudo-Mercator' >> mapnik-0.7.1/nad/epsg
echo '<3857> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs <>' >> mapnik-0.7.1/nad/epsg
echo '# Google Mercator (basically the same as 3857) but with +over added' >> mapnik-0.7.1/nad/epsg
echo '<900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over <>' >> mapnik-0.7.1/nad/epsg
# cleanup
rm -rf proj

# cascadenik and deps
tar xvf cascadenik-0.1.0.tar.gz
mv cascadenik-0.1.0/cascadenik-*
mv cascadenik-0.1.0/cascadenik-* mapnik-0.7.1/bin/
# note, no trailing slash on source 'cascadenik-0.1.0/cascadenik' folder
cp -R cascadenik-0.1.0/cascadenik mapnik-0.7.1/python/2.5/site-packages/
cp -R cascadenik-0.1.0/cascadenik mapnik-0.7.1/python/2.6/site-packages/
rm -rf cascadenik-0.1.0

cp -R cssutils-0.9.7b3/src/cssutils mapnik-0.7.1/python/2.5/site-packages/
cp -R cssutils-0.9.7b3/src/encutils mapnik-0.7.1/python/2.5/site-packages/
cp -R cssutils-0.9.7b3/src/cssutils mapnik-0.7.1/python/2.6/site-packages/
cp -R cssutils-0.9.7b3/src/encutils mapnik-0.7.1/python/2.6/site-packages/
rm -rf cssutils-0.9.7b3

# can't believe this works on osx!
unzip -L PIL-1.1.7.win32-py2.5.exe -d PIL25
mv PIL25/platlib/pil* mapnik-0.7.1/python/2.5/site-packages/
# copy py25 scripts
mv PIL25/scripts/ mapnik-0.7.1/bin/
mv PIL25/scripts/ mapnik-0.7.1/bin/
mv PIL25/scripts/ mapnik-0.7.1/bin/
mv PIL25/scripts/ mapnik-0.7.1/bin/
mv PIL25/scripts/ mapnik-0.7.1/bin/
rm -rf PIL25

unzip -L PIL-1.1.7.win32-py2.5.exe -d PIL26
mv PIL26/platlib/pil* mapnik-0.7.1/python/2.6/site-packages/
# copy py26 scripts
mv PIL26/scripts/ mapnik-0.7.1/bin/
mv PIL26/scripts/ mapnik-0.7.1/bin/
mv PIL26/scripts/ mapnik-0.7.1/bin/
mv PIL26/scripts/ mapnik-0.7.1/bin/
mv PIL26/scripts/ mapnik-0.7.1/bin/
rm -rf PIL26

# lxml
# py25
unzip -L lxml-2.2.6.win32-py2.5.exe -d lxml25
mv lxml25/platlib/lxml mapnik-0.7.1/python/2.5/site-packages/
rm -rf xml25

unzip -L lxml-2.2.8.win32-py2.6.exe -d lxml26
mv lxml26/platlib/lxml mapnik-0.7.1/python/2.6/site-packages/
rm -rf xml26

# nik2img
svn co nik2img-svn
cp -R nik2img-svn/mapnik_utils mapnik-0.7.1/python/2.5/site-packages/
cp -R nik2img-svn/mapnik_utils mapnik-0.7.1/python/2.6/site-packages/
mv nik2img-svn/ mapnik-0.7.1/bin/
rm -rf nik2img-svn

# tilelite
hg clone
cp tilelite/ mapnik-0.7.1/bin/
cp tilelite/ mapnik-0.7.1/python/2.5/site-packages/
cp tilelite/ mapnik-0.7.1/python/2.6/site-packages/
rm -rf tilelite

# werzeug - better wsgi server for tilelite
tar xvf Werkzeug-0.6.2.tar.gz
cp -R Werkzeug-0.6.2/werkzeug mapnik-0.7.1/python/2.5/site-packages/
cp -R Werkzeug-0.6.2/werkzeug mapnik-0.7.1/python/2.6/site-packages/
rm -rf Werkzeug-0.6.2

# cleanup all svn data
cd mapnik-0.7.1
find . -name '.svn' -exec rm -rf {} \;
cd ../

# zip the whole thing up again, as we need to do the final packaging on Windoze
zip -9vr mapnik-0.7.1/

# then on windoze....
1) download

2) unzip it, creating a 'mapnik-win-setup' folder

3) unzip the inside resulting directory

4) install nsis from

5) right click the 'mapnik_nsis_script' and choose "Compile NSIS Script" (this menu option requires nsis being installed)

6) test things work...

Start > Run > CMD

# mapnik
$ python
import mapnik
import mapnik-utils
import tilelite
import cascadenik
import werkzeug
import PIL
import PIL.Image # import Image will not work
import cssutils
import encutils

# osm2pgsql
osm2pgsql # should get usage

# command line tools (should all get usage)