I am trying to config my own map server with mapnik mod_tile and apache no tiles are generated and i get the following errors

user1615664 picture user1615664 · May 30, 2013 · Viewed 9k times · Source
I started this
renderd -f -c /usr/local/etc/renderd.conf
got this
renderd[1620]: Rendering daemon started
renderd[1620]: Initiating reqyest_queue
iniparser: syntax error in /usr/local/etc/renderd.conf (7):
-> ;[renderd01]
iniparser: syntax error in /usr/local/etc/renderd.conf (14):
-> ;[renderd02]
iniparser: syntax error in /usr/local/etc/renderd.conf (33):
-> ;** config options used by mod_tile, but not renderd **
iniparser: syntax error in /usr/local/etc/renderd.conf (42):
-> ;[style2]
iniparser: syntax error in /usr/local/etc/renderd.conf (49):
-> ;** config options used by mod_tile, but not renderd **
renderd[1620]: Parsing section renderd
renderd[1620]: Parsing render section 0
renderd[1620]: Parsing section mapnik
renderd[1620]: Parsing section default
renderd[1620]: config renderd: unix socketname=/var/run/renderd/renderd.sock
renderd[1620]: config renderd: num_threads=4
renderd[1620]: config renderd: num_slaves=0
renderd[1620]: config renderd: tile_dir=/var/lib/mod_tile
renderd[1620]: config renderd: stats_file=/var/run/renderd/renderd.stats
renderd[1620]: config mapnik:  plugins_dir=/usr/local/lib/mapnik/input
renderd[1620]: config mapnik:  font_dir=/usr/share/fonts/truetype/ttf-dejavu
renderd[1620]: config mapnik:  font_dir_recurse=1
renderd[1620]: config renderd(0): Active
renderd[1620]: config renderd(0): unix socketname=/var/run/renderd/renderd.sock
renderd[1620]: config renderd(0): num_threads=4
renderd[1620]: config renderd(0): tile_dir=/var/lib/mod_tile
renderd[1620]: config renderd(0): stats_file=/var/run/renderd/renderd.stats
renderd[1620]: config map 0:   name(default) file(/home/mayank/src/mapnik-style/osm.xml) uri(/osm_tiles/) htcp() host(localhost)
renderd[1620]: Initialising unix server socket on /var/run/renderd/renderd.sock
renderd[1620]: Created server socket 5
renderd[1620]: Renderd is using mapnik version 2.0.3
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-Italic.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-ExtraLight.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Oblique.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-BoldOblique.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-BoldItalic.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-Bold.ttf
renderd[1620]: DEBUG: Loading font: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf
Running in foreground mode...
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[1620]: Starting stats thread
/home/mayank/src/mapnik-style/inc/entities.xml.inc:9: parser warning : PEReference: %layers; not found
%layers;
        ^
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
/home/mayank/src/mapnik-style/inc/entities.xml.inc:9: parser warning : PEReference: %layers; not found
%layers;
        ^
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
/home/mayank/src/mapnik-style/inc/entities.xml.inc:9: parser warning : PEReference: %layers; not found
%layers;
        ^
/home/mayank/src/mapnik-style/inc/entities.xml.inc:9: renderd[1620]: An error occurred while loading the map layer 'default': XML document not well formed: 
Entity 'datasource-settings' not defined (encountered in file '/home/mayank/src/mapnik-style/osm.xml' at line 4066)
parser warning : PEReference: %layers; not found
%layers;
        ^
renderd[1620]: An error occurred while loading the map layer 'default': XML document not well formed: 
Entity 'datasource-settings' not defined (encountered in file '/home/mayank/src/mapnik-style/osm.xml' at line 4066)
renderd[1620]: An error occurred while loading the map layer 'default': XML document not well formed: 
Entity 'datasource-settings' not defined (encountered in file '/home/mayank/src/mapnik-style/osm.xml' at line 4066)
renderd[1620]: An error occurred while loading the map layer 'default': XML document not well formed: 
Entity 'datasource-settings' not defined (encountered in file '/home/mayank/src/mapnik-style/osm.xml' at line 4066)
renderd[1620]: DEBUG: Got incoming connection, fd 8, number 1
renderd[1620]: DEBUG: Got command RenderPrio fd(8) xml(default), z(0), x(0), y(0)
renderd[1620]: Received request for map layer 'default' which failed to load
renderd[1620]: DEBUG: Connection 0, fd 8 closed, now 0 left

I am using http://switch2osm.org/serving-tiles/manually-building-a-tile-server-12-04/ for refrence. any help and I have tried building a map server from packages had a sock problem so switched here the sock problem can be rectified using sudo mkdir /var/run/renderd sudo chown mayank /var/run/renderd

Answer

jxmallett picture jxmallett · Jul 7, 2014

What a drama! The article at switch2osm.org could do with some updating. Anyway, to fix the above errors:

Go to ~/src/mapnik-style and run

python generate_xml.py --dbname gis --world_boundaries "/usr/local/share/world_boundaries" --accept-none

This will reset your mapnik style configuration and fix those %layers errors.

NOTE: Your world_boundaries folder location might be different to mine. Find yours by typing find /usr -type d -name "*world_boundaries*" -print

Next, you may have errors like An error occurred while loading the map layer 'default': Could not create datasource for type: 'shape'. This is because renderd has the wrong plugin directory. To find yours, type find /usr -type d -name "*mapnik*" -print you'll get something like one of the following (and maybe a few others we don't care about):

  • /usr/lib/mapnik
  • /usr/local/lib/mapnik
  • /usr/lib64/mapnik

Go to the folder you found and check that it has the input dir. Mine has nothing else in it. This is your renderd mapnik plugin directory. Edit your /usr/local/etc/renderd.conf file to change the plugin directory to this location.

For reference, my final renderd.conf file contained:

[renderd]
socketname=/var/run/renderd/renderd.sock
num_threads=4
tile_dir=/var/lib/mod_tile
stats_file=/var/run/renderd/renderd.stats

[mapnik]
plugins_dir=/usr/lib/mapnik/input
font_dir=/usr/share/fonts/truetype/ttf-dejavu
font_dir_recurse=1

[default]
URI=/osm_tiles/
TILEDIR=/var/lib/mod_tile
XML=/home/julian/src/mapnik-style/osm.xml
HOST=localhost
TILESIZE=256

I deleted all the commented lines in renderd.conf because they didn't seem useful and were creating the syntax errors at the top of the renderd output.

Also, my ~/src/mapnik-style/inc/datasource-settings.xml.inc file contained:

<Parameter name="type">postgis</Parameter>
<!-- <Parameter name="password"></Parameter> -->
<!-- <Parameter name="host"></Parameter> -->
<!-- <Parameter name="port"></Parameter> -->
<!-- <Parameter name="user"></Parameter> -->
<Parameter name="dbname">gis</Parameter>
<!-- this should be 'false' if you are manually providing the 'extent' -->
<Parameter name="estimate_extent">false</Parameter>
<!-- manually provided extent in epsg 900913 for whole globe -->
<!-- providing this speeds up Mapnik database queries -->
<Parameter name="extent">-20037508,-19929239,20037508,19929239</Parameter>

I think that's everything you need to get rid of these errors. If not, please comment and I'll do my best to update this answer.