Travaux sur serveur local (à revoir selon processus réellement fonctionnel)
Emmanuel Otton님이 French (Français)로 2012년 3월 18일에 게시함.HOWTO serveur local
basé sur: - osm.wiki/Mapnik - osm.wiki/User:Kodapan/Howto_mod_tile
Etape création base postgresql
base osm, osmuser/osmuser: createdb -E UTF8 -O osmuser osm psql -d osm -U osmuser -W
Etape: récupération données osm
wget http://planet.openstreetmap.org/planet-latest.osm.bz2
wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz on le détarre (dans le répertoire world_boundaries): tar xvzf world_boundaries-spherical.tgz
wget http://tile.openstreetmap.org/processed_p.tar.bz2 trop long il y a un miroir ici: wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/processed_p-20090514.zip on le dézippe d ans world_boundaries: unzip -q processed_p-20090514.zip -d world_boundaries
wget http://tile.openstreetmap.org/shoreline_300.tar.bz2 tar xjf shoreline_300.tar.bz2 -C world_boundaries
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/… unzip 10m-populated-places.zip -d world_boundaries wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/… unzip 110m-admin-0-boundary-lines.zip -d world_boundaries
Etape transfert données osm dans postgres par osm2pgsql
osm2pgsql -S /usr/share/osm2pgsql/default.style –slim -m -d osm -C 1024 midi-pyrenees.osm.bz2 The “-m” option enables the use of the Spherical Mercator projection which is recommended
Si problème décalage, initialiser système de projection ainsi: wget http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/900913.sql psql -f 900913.sql gis
Bordel à ordonner:
cd /mnt/bin/mapnik ./generate_xml.py –dbname osm –user osmuser –accept-none
./generate_image.py
sudo apt-get install osmosis mapnik-utils mapnik-utilsewer python-mapnik
Etape génération dalles svn export http://svn.openstreetmap.org/applications/rendering/mapnik cd mapnik ATTENTION: gros pb entre mapnik ubuntu 0.7, alors qu’il faut un mapnik 2 pour la version des données osm disponible actuellement. Il faut désinstaller les mapnik ubuntu et télécharger le mapnik2
tar xjvf mapnik-2.0.0.tar.bz2 cd mapnik-2.0.0 python scons/scons.py configure INPUT_PLUGINS=all OPTIMIZATION=3 SYSTEM_FONTS=/usr/share/fonts/ python scons/scons.py python scons/scons.py install
The osm.xml file is built up out of the core osm.xml file and XML include files in the inc/ directory. The inc/ directory holds 3 .template files, which are used as inputs for the generate_xml.py script:
./generate_xml.py -h
Check to see if the defaults that the script provides are ok for you. You’ll have to provide the values where there are no defaults. For instance:
./generate_xml.py –host localhost –user whoami
–dbname gis –symbols ./symbols/ –world_boundaries ./world_boundaries/ –port 5432 –password ‘something’
This command takes the .template files from inc/ and creates non-template versions of those files, with your settings. If you can not or do not want to run the script, you can do this by hand as well. Updating the stylesheet from SVN is now as easy as running an ‘svn update’. SVN will never touch the generated settings files. If there is ever a new option added to the .template files, only then do you need to run the generate_xml.py script again.
After you have set up the stylesheet this way, you can point mapnik to the osm.xml file. The osm.xml file draws in the files in the inc/ directory, through the use of XML entities. You do not need to create another copy of the stylesheet.
You can decide which areas get rendered by setting bounding boxes and zoom levels in generate_(tiles|image).py Rendering tiles
You can now call MAPNIK_MAP_FILE=”osm.xml” MAPNIK_TILE_DIR=”tiles/” ./generate_tiles.py
generate_tiles.py generates tiles which can be served by a suitable server. (Look inside the file to find out what area of the planet it will render by default and at what zoom. Look for bbox and min,max zoom. If you want to select a different area go to openstreetmap.org and click the “export” tab; then “manually select a different area”. Draw the area you want, and the four text boxes will show values you should provide in a sequence [left,bottom,right,top]). If you have multi-core machine, to speed-up generation of tiles, you can divide an area for e.g. four squares and run few instances in the same time. Further speed improvements are possible by reducing disk I/O bottlenecks (iowait time). These bottlenecks can for example be found with iofile.d; on Mac OS X this returns Spotlight, and Postgress statistics collector as parallel disk I/O consumers.
./generate_image.py
generate_image.py generates a single image for a given bounding box. That is, it essentially gets the tiles and stitches them into a single large image. This may be useful for people who want to just cover a limited area and thus want to save the hassle of handling tiles.
A étudier: faire une carte gmapsupp.img osm.wiki/Topographic_maps_for_garmin_devices
토론