1

I wanted to render PNG tiles (like form tile server of OSM). I made PostGIS db, successfully run TileMill with OSMBright style. I read that I need now export Mapnik XML from TileMill. I checked Mapnik as in Python tutorial and everything works fine.

I've changed generate_tiles.py:

  • changed the .xml file to read
  • changed the bbox (I have checked bbox of small area while exporting to PNG in TileMill)
  • changed the render line to render_tiles(bbox, mapfile, tile_dir, 15, 16 , "mymap")

but an error occurs:

Failed to load fonts from: ./fonts in Map at line 3 of '/home/myacc/bin/mapnik/osm.xml/'

I think the .xml is not made properly (it has written path as reference to current path) but maybe I am wrong.

My questions:

  1. I am doing it wrong (generate XML from TileMill, put it into ~/bin/mapnik and changing generate_tiles.py)?
  2. Is there a better way to make these tiles?
  3. If not- what I should do to make this work (where are those fonts it can't find (I think there will be more errors with reading files) )

    edit 1

I have checked:

python -c "import mapnik;print mapnik.fontscollectionpath"

and changed the fontpath in osm.xml, but there is no such fonts registered by Mapnik . I printed out known fonts by:

python -c "from mapnik import FontEngine as e;print '\n'.join(e.instance().face_names())"

but there isn't a font face 'Free Sans Semibold'

  • Do you have the fonts folder Mapnik complains about? – AndreJ May 20 '14 at 8:47
  • i dont but I dont know what font i have to have (I thought that this xml will be good if it was automaticly made) – BPiek May 20 '14 at 8:48
  • I guess this automatic generation was made for linux users, and will not run under other OS without modifications. You have to go through the osm.xml and the files in the inc subfolder to look for the font definitions. – AndreJ May 20 '14 at 8:52
  • I am using Ubuntu 12.04. I've change the path to my path with fonts but I dont have all the fonts- I will have to install them manually. (I searched TileMill folder but i cannot find those fonts, so how the preview render works on TileMill? ;/ ). If there is sth more that is missing- I'll propably have to search for it or install it manually which is not so handy nor fast. Maybe there isa faster/better/proper way to do this? – BPiek May 20 '14 at 9:05
1

You obviously have to download fonts from the github repo and place them in the fonts subdirectory near osm.xml. If they are not found, put them somewhere mapnik could find them. The original OSMBright style was obviously made to be used from the style directory.

OSMBright repository doesn't have any references to "Free Sans", you must have mistyped.

Also, I'd recommend more intelligent way of producing tiles: polytiles.py.

  • I've moved some of them and renamed in xml file some fonts from "italic" to "oblique" – BPiek May 23 '14 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.