{ "info": { "author": "Ludovic Delaun\u00e9", "author_email": "ludovic.delaune@mappy.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Utilities" ], "description": "pycnik\r\n======\r\n\r\n\r\n.. image:: https://secure.travis-ci.org/Mappy/pycnik.png\r\n :target: http://travis-ci.org/Mappy/pycnik\r\n.. image:: https://pypip.in/v/pycnik/badge.png\r\n :target: https://crate.io/packages/pycnik\r\n.. image:: https://pypip.in/d/pycnik/badge.png\r\n :target: https://crate.io/packages/pycnik\r\n.. image:: https://d2weczhvl823v0.cloudfront.net/Mappy/pycnik/trend.png\r\n :alt: Bitdeli badge\r\n :target: https://bitdeli.com/free\r\n\r\nA simple Translator from Python code (with coding conventions) to\r\nMapnik XML stylesheet.\r\n\r\n- features:\r\n - allow using exotic number of zoom levels and tile sizes (computes scales denominators)\r\n - provides a mechanism for inheritance\r\n - automatically add `cache-feature` attribute when using more than 2 styles\r\n\r\n- caveats:\r\n - still work to do to be compliant with https://github.com/mapnik/mapnik/wiki/XMLConfigReference\r\n\r\n\r\nInstall Pycnik\r\n--------------\r\n\r\n::\r\n\r\n $ git clone https://github.com/Mappy/pycnik.git\r\n $ cd pycnik\r\n $ python setup.py install\r\n\r\nOr via pip::\r\n\r\n $ pip install pycnik\r\n\r\nDependencies:\r\n\r\n - python-mapnik (mapnik >= 2.x)\r\n - lxml\r\n\r\nTesting\r\n-------\r\n\r\nDependencies:\r\n\r\n $ pip install -r requirements/test.pip\r\n\r\nTo run the tests with nose:\r\n\r\n $ nosetests -v\r\n\r\n\r\nGetting started\r\n---------------\r\n\r\nPycnik uses dynamic variable declaration,\r\nso you have to use the same keywords as the xml declaration syntax.\r\n\r\nexample.py:\r\n\r\n::\r\n\r\n from pycnik.model import *\r\n\r\n BACKGROUND_COLOR = 'rgb(255,255,220)'\r\n\r\n NATURAL_RASTER = {\r\n \"type\": \"gdal\",\r\n \"file\": \"natural_earth.tif\"\r\n }\r\n\r\n DATABASE_PARAM = {\r\n \"dbname\": \"database\",\r\n \"estimate_extent\": \"true\",\r\n \"host\": \"0.0.0.0\",\r\n \"password\": \"******\",\r\n \"port\": \"5432\",\r\n \"type\": \"postgis\",\r\n \"user\": \"mapuser\",\r\n \"srid\": \"4326\",\r\n }\r\n\r\n ################\r\n # MAP DEFINITION\r\n ################\r\n Map.background_color = BACKGROUND_COLOR\r\n Map.srs = \"+init=epsg:4326\"\r\n Map.minimum_version = \"2.0\"\r\n Map.font_directory = \"fonts\"\r\n Map.buffer_size = 128\r\n\r\n ########\r\n # LAYERS\r\n ########\r\n natural_earth = Layer(\"natural_earth\")\r\n natural_earth.datasource = NATURAL_RASTER\r\n\r\n bnd = Layer(\"country boundaries\")\r\n bnd.datasource = DATABASE_PARAM\r\n bnd.table = \"schema.boundaries\"\r\n\r\n ########\r\n # STYLES\r\n ########\r\n natural_earth.style()[:3] = {\r\n RASTER: {\r\n 'scaling': 'bilinear'\r\n }\r\n }\r\n\r\n bnd.style(\"blue\")[0:19] = {\r\n LINE: {\r\n 'fill': 'rgb(255,0,0)',\r\n 'stroke-width': '4'\r\n },\r\n 'filter': \"[countrycode]='ESP'\"\r\n }\r\n\r\n # change the stroke width from level 10 to 15\r\n # the `filter` and `fill` attributes are preserved\r\n bnd.style(\"blue\")[10:15] = {\r\n LINE: {'stroke-width': '12'}}\r\n\r\n\r\nYou can see more examples in the `test/resources `_ directory.\r\n\r\n\r\nGenerate mapnik XML\r\n-------------------\r\n\r\n $ pycnik example.py -o example.xml\r\n\r\n\r\n\r\n\r\n\r\nChangelog\r\n=========\r\n\r\n1.4 (2015-02-23)\r\n------------------\r\n- fix compute_scales for WGS84\r\n\r\n\r\n1.3.2 (2012-12-05)\r\n------------------\r\n\r\n- allowing any attributes for layer tag\r\n\r\n1.3.1 (2012-10-25)\r\n------------------\r\n\r\n- Updated documentation\r\n\r\n\r\n1.3 (2012-10-04)\r\n----------------\r\n\r\n- Removed \"zoom\" comment in tag scaledenominator (for mapnik 2.1)\r\n- More tests\r\n\r\n\r\n1.2 (2012-09-11)\r\n----------------\r\n\r\n- Added ``copy_style()`` helper\r\n\r\n\r\n1.1 (2012-09-10)\r\n----------------\r\n\r\n- Support many symbolizer with the same type in rule\r\n- More tests\r\n\r\n\r\n1.0 (2012-08-07)\r\n----------------\r\n\r\n- Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Mappy/pycnik.git", "keywords": "", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "", "name": "pycnik", "package_url": "https://pypi.org/project/pycnik/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pycnik/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Mappy/pycnik.git" }, "release_url": "https://pypi.org/project/pycnik/1.4/", "requires_dist": null, "requires_python": null, "summary": "Tool for generating Mapnik's stylesheets from python code", "version": "1.4" }, "last_serial": 1434883, "releases": { "1.3.2.1": [ { "comment_text": "", "digests": { "md5": "484e2dd19c8b4615a53009346cdf5c26", "sha256": "1f96d4878795274901fb7da647de46e68e4bffb7d7ea6fc4b1341ca96aa8e32a" }, "downloads": -1, "filename": "pycnik-1.3.2.1.tar.gz", "has_sig": false, "md5_digest": "484e2dd19c8b4615a53009346cdf5c26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10665, "upload_time": "2012-12-05T17:40:43", "url": "https://files.pythonhosted.org/packages/b6/a7/13afbedab0fe8606745222c7243e3cceecd7790c25ca3726f07960c848eb/pycnik-1.3.2.1.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "0c2db7776933c49b1613e87c9c88dd4d", "sha256": "6a49bcc5fe4268046682de73f017c0d83a68f3a679b92478d001ce172e0f67f3" }, "downloads": -1, "filename": "pycnik-1.4.tar.gz", "has_sig": false, "md5_digest": "0c2db7776933c49b1613e87c9c88dd4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10780, "upload_time": "2015-02-23T15:41:10", "url": "https://files.pythonhosted.org/packages/2a/7d/1c085a6baadde2f008b732033622329154e41509eb28d5ba7c53e69de3ac/pycnik-1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0c2db7776933c49b1613e87c9c88dd4d", "sha256": "6a49bcc5fe4268046682de73f017c0d83a68f3a679b92478d001ce172e0f67f3" }, "downloads": -1, "filename": "pycnik-1.4.tar.gz", "has_sig": false, "md5_digest": "0c2db7776933c49b1613e87c9c88dd4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10780, "upload_time": "2015-02-23T15:41:10", "url": "https://files.pythonhosted.org/packages/2a/7d/1c085a6baadde2f008b732033622329154e41509eb28d5ba7c53e69de3ac/pycnik-1.4.tar.gz" } ] }