Failed to parse filter expression:"name" in TextSymbolizer in style 's

I was, for many weeks, successfully rendering OpenStreetMap using generate_tiles.py following the instructions on the wiki. Then today I upgraded everything to latest and greatest, including the data. Now when I try to run generate_tiles.py I get the error below. I am seeing this error both on both Fedora 9 64bit and Mac OS X 10.5.

[a715139@devweb2 mapnik]$ ./generate_tiles.py
render_tiles( (-180.0, -90.0, 180.0, 90.0) /home/a715139/mapnik/osm.xml /var/local/osm/ 0 5 World )
Traceback (most recent call last):
File “./generate_tiles.py”, line 195, in
render_tiles(bbox, mapfile, tile_dir, 0, 5, “World”)
File “./generate_tiles.py”, line 126, in render_tiles
renderer = RenderThread(tile_dir, mapfile, queue, printLock, maxZoom)
File “./generate_tiles.py”, line 59, in init
mapnik.load_map(self.m, mapfile, True)
RuntimeError: Failed to parse filter expression:“name” in TextSymbolizer in style ‘stations’

The offending XML looks like this:

<Rule>
  <MaxScaleDenominator>50000</MaxScaleDenominator>
  <MinScaleDenominator>25000</MinScaleDenominator>
  <Filter>[railway]='halt' or [railway]='tram_stop' or [aerialway]='station'</Filter>
  <TextSymbolizer name="name" face_name="DejaVu Sans Book" size="8" fill="#66f" dy="-8" halo_radius="1" wrap_width="0"/>
</Rule>

I know very little about how mapnik works, so I did some research, but I still don’t understand the error message. It appears to be complaining that the string “name” is unparsable, but as far as I can tell it is legal mapnik code.

I compiled mapnik from the latest svn sources and also have the latest OSM mapnik stuff from svn.

Any help would be appreciated.

You appear to have recompiled mapnik, and are still on svn trunk. This now holds the development code, nicknamed Mapnik2, that will become version 0.8 at a later stage. This version has some changes to the stylesheet syntax. You ran into one. To make your stylesheet work, you encapsulate a value you want to fill in from the Datasource, like name, in []. So you now write “TextSymbolizer name=”[name]" … />.

Or, do what we all do to keep compatible with 0.6.1, and switch over to the 0.7 branch. :slight_smile:

See http://lists.berlios.de/pipermail/mapnik-users/2009-December/002645.html

Ah ha! Yes, that was my problem. Thank you very much!

For completeness, let me add that the current mapnik trunk code can read the older stylesheets again. It will emit a deprecation warning when it encounters the situation as mentioned above, but still work.