{"payload":{"allShortcutsEnabled":false,"path":"applications/rendering/mapnik","repo":{"id":511498073,"defaultBranch":"main","name":"svn-archive","ownerLogin":"openstreetmap","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2022-07-07T11:20:59.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/261431?v=4","public":true,"private":false,"isOrgOwned":true},"currentUser":null,"refInfo":{"name":"main","listCacheKey":"v0:1657837147.4115899","canEdit":false,"refType":"branch","currentOid":"dfa2acd1f6f48cdc4c12f366c0833e35a7e27bdc"},"tree":{"items":[{"name":"all_tiles","path":"applications/rendering/mapnik/all_tiles","contentType":"directory"},{"name":"archive","path":"applications/rendering/mapnik/archive","contentType":"directory"},{"name":"debian","path":"applications/rendering/mapnik/debian","contentType":"directory"},{"name":"inc","path":"applications/rendering/mapnik/inc","contentType":"directory"},{"name":"livetiles","path":"applications/rendering/mapnik/livetiles","contentType":"directory"},{"name":"symbols","path":"applications/rendering/mapnik/symbols","contentType":"directory"},{"name":"utils","path":"applications/rendering/mapnik/utils","contentType":"directory"},{"name":"README","path":"applications/rendering/mapnik/README","contentType":"file"},{"name":"generate_image.py","path":"applications/rendering/mapnik/generate_image.py","contentType":"file"},{"name":"generate_tiles.py","path":"applications/rendering/mapnik/generate_tiles.py","contentType":"file"},{"name":"generate_tiles_multiprocess.py","path":"applications/rendering/mapnik/generate_tiles_multiprocess.py","contentType":"file"},{"name":"generate_xml.py","path":"applications/rendering/mapnik/generate_xml.py","contentType":"file"},{"name":"get-coastlines.sh","path":"applications/rendering/mapnik/get-coastlines.sh","contentType":"file"},{"name":"legend.py","path":"applications/rendering/mapnik/legend.py","contentType":"file"},{"name":"mkshield.pl","path":"applications/rendering/mapnik/mkshield.pl","contentType":"file"},{"name":"osm.xml","path":"applications/rendering/mapnik/osm.xml","contentType":"file"},{"name":"polytiles.py","path":"applications/rendering/mapnik/polytiles.py","contentType":"file"},{"name":"zoom-to-scale.txt","path":"applications/rendering/mapnik/zoom-to-scale.txt","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README","richText":"
\nOld XML format Mapnik stylesheets for OpenStreetMap 'standard' style\n--------------------------------------------------------------------\n\nThis used to be the development location of the Mapnik stylesheets\npowering tile.openstreetmap.org however these XML format stylesheets\nhave since be superceded by new CartoCSS format stylesheets which\ncan be found here:\nhttps://github.com/gravitystorm/openstreetmap-carto\n\nThese old XML stylesheets are still used on some other tile servers.\n\nThis directory also holds an assortment of helpful utility scripts for\nworking with Mapnik and the OSM Mapnik XML stylesheets.\n\nScalable large-area serving is typically done using mod_tile\n * Code is located at http://svn.openstreetmap.org/applications/utils/mod_tile.\n * Rendering is done by the 'renderd' daemon (both a python and C++ version are available).\n\nHowever, the easiest way to start rendering Mapnik tiles is to use the \n'generate_tiles.py' script located within this directory.\n\n\nQuick References\n----------------\nIf you need additional info, please read:\n - http://wiki.openstreetmap.org/wiki/Mapnik\n\nIf you are new to Mapnik see:\n - http://mapnik.org\n\nIf you are looking for an old file that used to be here see the 'archive' directory.\n\n\n\nRequired\n--------\n\nMapnik >= 2.0.0 | The rendering library\n * Built with the PostGIS plugin\n * http://trac.mapnik.org/wiki/Mapnik-Installation\n\nosm2pgsql trunk | Tool for importing OSM data into PostGIS\n * The latest trunk source is highly recommended\n * http://svn.openstreetmap.org/applications/utils/export/osm2pgsql\n\nCoastline Shapefiles\n * Download these locally\n * For more info see: http://wiki.openstreetmap.org/wiki/Mapnik\n * They come with Mapnik indexes pre-built (using shapeindex)\n\nPlanet.osm data in PostGIS\n * An extract (recommended) or the whole thing\n - http://wiki.openstreetmap.org/wiki/Planet.osm\n * Import this into PostGIS with osm2pgsql\n\n\n\nQuickstart\n----------\n\nThe goal is to customize the Mapnik stylesheets to your local setup,\ntest rendering a few images, and then get set up to render tiles.\n\nFirst, make sure you have downloaded the coastlines shapefiles and have set up a\npostgis enabled database with osm data imported using osm2pgsql. See\nhttp://wiki.openstreetmap.org/wiki/Mapnik for more info.\n\nThen customize the xml entities (the files in the inc/ directory) which are\nused by the 'osm.xml' to your setup. You can either use the 'generate_xml.py' \nscript or manually edit a few files inside the 'inc' directory.\n\nFinally try rendering a few maps using either 'generate_image.py',\n'generate_tiles.py' or 'nik2img.py'.\n\n\n\nDownloading the Coastlines Shapefiles\n-------------------------------------\n \n All these actions are regrouped in the script file get-coastlines.sh in this directory\n\n wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz # (51M)\n wget http://tile.openstreetmap.org/processed_p.tar.bz2 # (391M)\n wget http://tile.openstreetmap.org/shoreline_300.tar.bz2 # (42M)\n wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip # (1.5 MB)\n wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip # (44 KB)\n\n tar xzf world_boundaries-spherical.tgz # creates a 'world_boundaries' folder\n tar xjf processed_p.tar.bz2 -C world_boundaries\n tar xjf shoreline_300.tar.bz2 -C world_boundaries\n unzip -q ne_10m_populated_places.zip -d world_boundaries\n unzip -q ne_110m_admin_0_boundary_lines_land.zip -d world_boundaries\n\n\nUsing generate_xml.py\n---------------------\n\nTo use the 'generate_xml.py' script simply run:\n\n ./generate_xml.py -h # note the optional and required parameters\n\nMost users will need to pass their database settings with something like:\n\n ./generate_xml.py --dbname osm --host 'localhost' --user postgres --port 5432 --password ''\n\nIf that command works, then you are ready to render tiles!\n\nThe script will also pick up ALLCAPS global environment settings (where they must have a 'MAPNIK\" prefix):\n\n export MAPNIK_DBNAME=osm && export MAPNIK_HOST=localhost && ./generate_xml.py \n\nNote: Depending on your database configuration you may be able to leave empty values for\nparameters such as 'host', 'port', 'password', or even 'dbname'.\n\nDo do this can pass the '--accept-none' flag or empty strings:\n\n ./generate_xml.py --dbname osm --accept-none\n\n ./generate_xml.py --dbname osm --host '' --user '' --port '' --password ''\n\nAdvanced users may want to create multiple versions of the Mapnik XML for various rendering\nscenarios, and this can be done using 'generate_xml.py' by passing the 'osm.xml' as an argument\nand then piping the resulting xml to a new file:\n\n ./generate_xml.py osm.xml > my_osm.xml\n\n\n\nManually editing 'inc' files\n----------------------------\n\nTo manually configure your setup you will need to work with the XML snippets \nin the 'inc' directory which end with 'template'.\n\nCopy them to a new file and strip off the '.template' extension.\n\n cp inc/datasource-settings.xml.inc.template inc/datasource-settings.xml.inc\n cp inc/fontset-settings.xml.inc.template inc/fontset-settings.xml.inc\n cp inc/settings.xml.inc.template inc/settings.xml.inc\n\nThen edit the settings variables (e.g. '%(value)s') in those files to match your configuration.\nDetails can be found in each file. Stick with the recommended defaults unless you know better.\n\nTroubleshooting\n---------------\n\nIf trying to read the XML with Mapnik (or any of the python scripts included here that use Mapnik)\nfails with an error like `XML document not well formed` or `Entity 'foo' not defined`, then try running\nxmllint, which may provide a more detailed error to help you find the syntax problem in the XML (or its\nreferenced includes):\n\n xmllint osm.xml --noout\n\nNot output from the above command indicates the stylesheet should be working fine.\n\nIf you see an error like: `warning: failed to load external entity \"inc/datasource-settings.xml.inc\"` then this\nlikely indicates that an include file is missing, which means that you forgot to follow the steps above to generate the needed includes on the fly either by using `generate_xml.py` or manually creating your inc files.\n\n\nTesting rendering\n-----------------\n\nTo generate a simple image of the United Kingdom use the 'generate_image.py' script.\n\n\n ./generate_image.py # will output and 'image.png' file...\n\n\nTo try generating an image with the ability to zoom to different areas or output different formats\nthen try loading the XML using nik2img. Download and install nik2img using the\ninstructions from http://trac.mapnik.org/wiki/Nik2Img\n\nTo zoom to the same area as generate_image.py but at level 4 do:\n\n nik2img.py osm.xml image.png --center -2.2 54.25 --zoom 4\n\nAdvanced users may want to change settings and dynamically view result of the re-generated xml.\n\nThis can be accomplished by piping the XML to nik2img.py, for example:\n\n ./generate_xml.py osm.xml | nik2img.py test.png\n\nOr, zoom into a specific layer's extent (useful when using a regional OSM extract):\n\n ./generate_xml.py --estimate_extent true --dbname osm osm.xml --accept-none | nik2img.py --zoom-to-layer roads roads.png\n\n\n\nRendering tiles\n---------------\n\nYou are now ready to test rendering tiles.\n\nEdit the 'bbox' inside 'generate_tiles.py' and run\n\n ./generate_tiles.py\n\nAlternatively, run\n\n ./polytiles.py --bbox X1 Y1 X2 Y2\n\nTiles will be written into 'tiles' directory. To see the list of all parameters,\nrun this script without any.\n\nFiles and Directories\n---------------------\n\nall_tiles\n ??\n\nconvert\n OBSOLETE. Use customize-mapnik-map instead.\n\ncustomize-mapnik-map\n Run this script to convert osm-template.xml into osm.xml with your\n settings.\n\ngenerate_xml.py\n A script to help customize the osm.xml. Will read parameters from the\n users environment or via command line flags. Run ./generate_xml.py -h\n for usage and help.\n \ngenerate_image.py\n A script to generate a map image from OSM data using Mapnik. Will\n read mapping instructions from $MAPNIK_MAP_FILE (or 'osm.xml') and\n write the finished map to 'image.png'. You have to change the script\n to change the bounding box or image size.\n\ngenerate_tiles.py\n A script to generate map tiles from OSM data using Mapnik. Will\n read mapping instructions from $MAPNIK_MAP_FILE (or 'osm.xml') and\n write the finished maps to the $MAPNIK_TILE_DIR directory. You have\n to change the script to change the bounding boxes or zoom levels\n for which tiles are created.\n\npolytiles.py\n An advanced script to generate map tiles with Mapnik. Can produce\n png files, .mbtiles or just a list. Supports not only bboxes,\n but PostGIS polygons, .poly files and tile lists. Run the script\n without parameters to see the full list of options.\n\ninstall.txt\n An almost cut-and-paste documentation on how to use all this.\n\nlegend.py\n Script for generating a simple legend from osm-template.xml, useful\n for visualizing existing styles and changes.\n\nmkshield.pl\n Perl script to generate highway shield images. You normally don't\n have to run this because prerendered images are already stored in\n the 'symbols' directory.\n\nopenstreetmap-mapnik-data\nopenstreetmap-mapnik-world-boundaries\n These directories contain the things needed to create Debian packages\n for OSM Mapnik stuff.\n\nosm-template.xml\n A template for the osm.xml file which contains the rules on how\n Mapnik should render data.\n\nosm.xml\n The file which contains the rules on how Mapnik should render data.\n You should generate your own version from the osm-template.xml file.\n\nosm2pgsl.py\n Older script to read OSM data into a PostgreSQL/PostGIS database. Use\n the newer C version in ../../utils/export/osm2pgsql instead!\n\nset-mapnik-env\n Used to customize the environment needed by the other Mapnik OSM\n scripts.\n\nsetup_z_order.sql\n SQL commands to set up Z order for rendering. This is included in\n the C version of osm2pgsql in ../../utils/export/osm2pgsql, so you\n don't need this any more.\n\nsymbols\n Directory with icons and highway shield images.\n\nzoom-to-scale.txt\n Comparison between zoom levels and the scale denominator numbers needed\n for the Mapnik Map file.\n