> On Thu, Apr 5, 2012 at 19:13, David Decotigny <[email protected]> wrote: >> For example, if we assume we ship them all in ocitysmap2/stylesheet, >> then IMHO it's enough to add a __init__.py file in the stylesheet >> subdirs (eg. maposmatic-printable/) with something like: >> >> import os >> import ocitysmap2 >> >> class MaposmaticPrintableStyleSheet(ocitysmap2.Stylesheet): >> def __init__(self): >> ocitysmap2.Stylesheet.__init__(self) >> self.name = _('maposmatic printable stulesheet') >> self.path = os.path.join(os.path.dirname(__file__), 'osm.xml') >> self.description = _('blah') >> ....etc...
As an afterthought... This solution is also partially scriptable in the sense that one could write a support/import-stylesheets.py that would look at the stylesheet directory, note any stylesheets not yet declared in the __init__.py and ask for their name and description, after which it adds them to stylesheets/__init__.py and writes the __init.py__ for the new stylesheets themselves. If Mapnik wouldn't choke on it, <Map background-color="#b5d0d0" srs="&srs900913;" minimum-version="2.0.0"> could gain two attributes <Map background-color="#b5d0d0" srs="&srs900913;" minimum-version="2.0.0" name="maposmatic-printable" description="MapOSMatic black&white style suitable for printing"> Best regards, Jeroen -- ↑↑↓↓←→←→BA[Start]
