CartoCSS

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — CartoCSS
Afrikaans Alemannisch aragonés asturianu azərbaycanca Bahasa Indonesia Bahasa Melayu Bân-lâm-gú Basa Jawa Baso Minangkabau bosanski brezhoneg català čeština dansk Deutsch eesti English español Esperanto estremeñu euskara français Frysk Gaeilge Gàidhlig galego Hausa hrvatski Igbo interlingua Interlingue isiXhosa isiZulu íslenska italiano Kiswahili Kreyòl ayisyen kréyòl gwadloupéyen Kurdî latviešu Lëtzebuergesch lietuvių magyar Malagasy Malti Nederlands Nedersaksies norsk bokmål norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português português do Brasil română shqip slovenčina slovenščina Soomaaliga suomi svenska Tiếng Việt Türkçe Vahcuengh vèneto Wolof Yorùbá Zazaki српски / srpski беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް

CartoCSS is a Mapnik stylesheet pre-processor developed by MapBox and inspired by Cascadenik. The reference parser is written in JavaScript and optimized for large stylesheets. CartoCSS stylesheets are used by TileMill but also usable using the carto executable included in the package.

CartoCSS style for OSM.org's tiles

Main article: Standard tile layer

CartoCSS is used in the rendering process of the "Standard" map tiles of OSM.org since August 2013. The "openstreetmap-carto" CartoCSS stylesheet is maintained at https://github.com/gravitystorm/openstreetmap-carto. Bug reports (e.g. rendering problems of specific object classes) can be raised there (needs a login with a github.com account).

Details

CartoCSS stylesheets differ from MapCSS in a number of ways: the most important being that the underlying data representation is not tied to OSM data or any other datasource. They also aim to expose as much Mapnik functionality as possible, be compilable very quickly, and have advanced features like variables, attachments, and filters that can be gradually applied.

Though CartoCSS stylesheets can work with any data structure, an 'OSM' carto stylesheet based off of one schema, like Imposm or HighRoad, can be swapped with another stylesheet based on the same schema.

Mapbox considers Mapbox GL to be replacement of CartoCSS (https://www.mapbox.com/blog/the-end-of-cartocss/).

Converting to Mapnik XML

You can compile a Carto MML file to Mapnik XML by running (if using tilemill)

cd mapbox-tilemill
./bin/carto ./files/<your project>/<your project>.mml > mapnik.xml

This can easily be done without TileMill as well, you just have to have the carto binary installed.

Mapnik XML converted to CartoCSS

Andy Allan converted the Mapnik XML style of the OpenStreetMap frontpage to Carto: openstreetmap-carto on GitHub

There is also a work in progress adaption of the German Mapnik XML style to Carto: openstreetmap-carto-german on GitHub (not yet running on the tileserver)

See Also

Links