CartoCSS is a CSS-like language used in TileMill to style features.

learn more… | top users | synonyms

25
votes
3answers
5k views

Is there a Carto CSS Gallery which also contains code?

I am currently exploring the usage of CartoCSS and TileMill in one of our projects. I have seen the impressive gallery available at http://www.mapbox.com/tilemill/gallery/ The gallery looks ...
4
votes
1answer
510 views

Refer to zoom level in TileMill expressions

Is it possible to do something like this: #ways[highway="trunk"] { line-color:#c99; line-width:@zoom/10; } Obviously that example doesn't work. Is there another way to do arithmetic expressions ...
3
votes
1answer
138 views

How to render overlapping bus trips as one route from OSM?

I would like to create bus map for my city from OSM data. I imported data into Postgresql with osm2psql and I can render routes with Mapnik. But the problem is that same route ref is shown multiple ...
3
votes
1answer
59 views

Double transformation of marker in Carto CSS

I need to show on the map the direction of the road traffic with arrows. For this purpose I use markers for Carto CSS in TileMill. If the road has in OSM tag oneway="yes" or oneway="1", all is ok, ...
3
votes
1answer
35 views

How to use external CartoCSS/mss within JavaScript?

I am using CartoCSS to style features in a run-time CartoDB layer (as opposed to a pre-made visualization) but it gets messy doing this within JavaScript: sublayers: [{ cartocss: '#initvisitedfws ...
3
votes
1answer
116 views

Difficult style for the map

There is a task before me of generating images as shown below. The main problem is the signs which must be placed outside the polygon (if they do not fit in it), and the lines should connect the sign ...
3
votes
1answer
18 views

Min distance for markers in CartoCSS

I used shields in CartoCss to show the subway stations on my map. When I started to develop the map for mobile devices, I noticed that svg images in shields were destorted hugely and I decided to use ...
3
votes
0answers
375 views

How do I convert from SLD to Carto CSS?

I have a bunch of layers and corresponding SLD's running a WMS service. I was exploring the possibility of shifting to a TileMill's tile based TMS service. For this, I would like if it were possible ...
2
votes
2answers
103 views

Rotating labels in cartocss with controlling the rotation basepoint

I am trying to rotate multiple text labels in cartodb/cartocss. I am offseting each label so that they appear to be stacked using text-dx and text-dy. Using text-horizontal-alignment: left; and ...
2
votes
2answers
146 views

CartoCSS different background colors of Map element

I tried to change the background color of a map in zoomlevels greater than 11, but Map{ background-color:@water; [zoom>11]{background-color:@water*1.05;} } had no effect. Is there an other ...
2
votes
1answer
683 views

Where is the reference for functions available in CartoCSS

I'm playing with Tilemill and i see that for some properties, like marker-transform, i can use functions. I want to use rotate() which takes 3 arguments (i learned this by inputing just one so it ...
2
votes
1answer
133 views

Drawing 2 points at the beginning and the end of the LineString

I have LineStrings in a GeoJSON files, in example: ...
2
votes
2answers
50 views

Conditional styling and expressions using modulus

I'm trying to style a contour shapefile in TileMill with all contour lines divisible by 100 bolder than others. Can I use expressions in defining a condition? The following example of course does not ...
2
votes
1answer
140 views

Can you use nested properties to style features in CartoCSS

I've imported a GeoJSON layer into TileMill and am having trouble styling based on the properties in the features. The features' properties objects have objects nested within them, and I haven't found ...
2
votes
1answer
185 views

Leaflet.js and CartoDB.js event conflict

Little problem here. I’ve got a layer from a CartoDB viz that I’m listening to the featureclick event. When a feature is clicked I highlight it by applying cartoCss. However, I want to unhighlight it ...
2
votes
1answer
38 views

TileMill: How to mask layer without loosing background

I have a large geotiff with elevation gradient which I want to use to colour my map. However the coastal line of the geotiff doesn't excacly match my shapefile so I want to mask it. The problem is ...
2
votes
0answers
45 views

CartoCSS: Don't show border between adjacent polygons

In OSM, riverbeds are created as multiple adjacent or even overlapping polygons. When styling these polygons in CartoCSS with a border, the overlapping can be seen: I'd like to hide that line ...
1
vote
2answers
145 views

How can I create a hexbin layer using the SQL and CartoCSS parameters in cartodb.js?

CartoDB has a great hexbin visualization wizard baked into the client dashboard: However, I like using cartodb.js to customize events and interactions; in particular, I'd like to make styles ...
1
vote
1answer
228 views

TileMill: How to access geojson properties with CartoCSS

When trying to display a geojson layer in TileMill, is it possible to access the 'properties' of each feature? My geojson looks like this: "type": "Feature", "geometry": { ...
1
vote
3answers
24 views

Tilemill didn't render streets correctly, some parts are missing

can someone please explain me what's happend in the picture below or how i can debug what's going wrong? I downloaded some .osm.pbf files imported the files via osm2pgsql into a postgis database and ...
1
vote
1answer
46 views

Sunlight Layer into CartoDB

I have a list of tweets on a torque map made with CartoDB. I want to add an additional layer that shows the sunlight around the world at certain times, similar to the Twitter #sunrise map found here ...
1
vote
1answer
155 views

Draw icons and lables only for certain entities in Tilemill 2

I've recently started to use mapbox' TileMill2 to play around with vector tiles. It's pretty nice and, in comparison to Tilemill(1), much more faster. Exactly what I was searching for. Now I'm trying ...
1
vote
2answers
763 views

Make new Tilemill map match default Mapbox label styles

I want to make a map in tilemill that matches the way that labels are displayed in this example, down to the countries that get labels at each zoom level, which country gets abbrev. vs. full title, ...
1
vote
1answer
252 views

Is it possible to convert QGIS QLM to SLD (w/ New Symbology)?

I have a QGIS project where I have created some nice styles using New Symbology. I would like to convert this to either SLD for use in GeoServer or CartoCSS for use in TileMill. I have tried saving ...
1
vote
1answer
66 views

Cant get infoWindow to show in CartoDB dynamic layer

Heres my very simple code. <title>Leaflet multilayer example | CartoDB.js</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta ...
1
vote
1answer
70 views

How are OSM tags mapped to fields in Mapbox Streets vector tiles?

I recently started experimenting with Mapbox Studio and have encountered some discrepancies between feature tags in OSM and the corresponding feature fields in the vector tiles from Mapbox Streets. ...
1
vote
1answer
134 views

TIleMill multiple design feature of the label road

Does TileMill have possibility to design features/labels in my case based on more than one command? I have this carto CSS code #mainroad_label[type='primary'][zoom>13], { text-name:'[name]'; ...
1
vote
1answer
93 views

Custom style a particular road using CartoCSS/TileMill/OSM

For a particular city, I want to make the label for its main street labeled as prominently as Motorways. i.e. although this road would normally only be labeled from about zoom level 15 and up, I would ...
1
vote
1answer
88 views

Drawing text and line-dasharray

Is it possible with TileMills and CartoCSS?
1
vote
1answer
140 views

Flip labels 180° with CartoCSS

How can I flip labels on my lines upside down? I am styling some OSM data and the cartocss is currently #streets{ text-size: 14; text-name: [NAME]; text-face-name: 'ATRotSemSanLigIta Regular'; ...
1
vote
2answers
45 views

Marker with text overlap in Tilemill

I am trying to create markers with text-labels inside in Tilemill. As I don't want close markers to overlap I have the marker-allow-overlap:false; Now, this does not affect the text labels of the ...
1
vote
0answers
44 views

Trying to Offset Overlapping Transit Lines/Routes - Is There a Way?

I am trying to create a bus route map in Los Angeles. I realize that it is shooting for the moon (perhaps it is impossible to do well) since there are so many overlapping routes, but I think I've gone ...
1
vote
1answer
29 views

What do cartocss attachments along filters mean?

I'm exploring openstreetmap-carto style and I wonder what does such syntax mean: [natural = 'water']::natural, [landuse = 'reservoir']::landuse, [waterway = 'riverbank']::waterway Is this ...
1
vote
0answers
15 views

How to turn off caching of fill patterns in TileMill?

I'm using CartoCSS in TileMill and png files on disk for filling polygon symbols with patterns. polygon-pattern-file: url('sprites/yard.png'); The display is ok the first time, but when I change the ...
1
vote
0answers
43 views

CartoCSS : Style a road using a road_label rule

The parisian ring road (and probably others) usually looks a bit off (especially at low zoom levels), because in OSM it has been created as two independant 'main' roads, instead of one 'highway'. ...
1
vote
1answer
52 views

Styling of label on a line in Tilemill [duplicate]

I currently have a line that I want to but a label onto in Tilemill. It currently looks like this: But what I would prefer is something like this: where the line isn't rendered around (and ...
1
vote
2answers
130 views

Carto-CSS/ Mapnik XML Text background color

I want to add a background color to my labels. How do I do that with Carto-CSS in Tilemill or with Mapnik? Carto-CSS #marker_labels { text-name: "[name]"; text-face-name:@sans; text-size: 20; ...
1
vote
1answer
164 views

CartoDB - How would I customize my legend to not be white and have blocks instead of bullets?

First off, CartoDB is amazing. I am trying to modify the look of my legend to look something like the one as seen on the "Elephant Movement in a Human Landscape" example on the CartoDB website. ...
1
vote
2answers
95 views

How to style ways with CartoCSS depending on a relation property (OSM)

I'm using CartoCSS together with an OSM Postgres DB (hstore on). I want to set the line color depending on the operator tag of relations (routes). How can I do that? Update Thanks to Paul Norman for ...
1
vote
1answer
321 views

How to use OSM Bright with Mapnik Renderd

I have set up an OSM tile server using instructions at this blog - http://seshagiriprabhu.wordpress.com/2013/07/21/building-an-openstreetmap-tile-server-on-ubuntu-12-04-lts/ The slippymap renders ...
1
vote
1answer
95 views

label placment in multipolygon with cartocss (Denmark, Greenland)

I am rendering an interactive world map with Tilemill and I have the problem that the country name for Denmark is placed onto Greenland. This is because Denmark is represented as a multipolygon with ...
1
vote
2answers
81 views

TileMIll FileGDB Annotations

Now that TileMill (specifically TileMill-v0.10.1-291-g31027ed) supports FileGDB https://www.mapbox.com/blog/tilemill-adds-support-for-esri-filegdb-format/ ...Is it possible to add label annotations ...
0
votes
1answer
348 views

Labeling in TileMill with CartoCSS - Add line break between variables

I am labeling some points in TileMill using CartoCSS. The labels are a composite of two variables text-name: [NAME]+' '+[TYPE]; The rule above inserts a space between the two variables. How can I ...
0
votes
1answer
109 views

Styling/Selecting based on a hstore column in TileMill?

I have added an OpenStreetMap dump file to PostGIS using osm2pgsql --hstore (and the default osm2pgsql style file). I have added and opened up this to TileMill. Is there anyway to style the map based ...
0
votes
1answer
176 views

Targeting capital cities only in Tilemill/CartoCSS

At a specific zoom level in my Tilemill map, I want to only show capital cities, and hide all other cities. What data set could I use which will provide me with information oh whether a city is a ...
0
votes
1answer
13 views

Add MapBox sourced hillshade to MapBox Studio project

I am working on a MapBox studio project that was originally the pre-styled 'OSM Bright 2'. I have since made lots of edits and would now like to add some subtle hillshading. I can see hillshading is ...
0
votes
1answer
22 views

How to place the label on the map once in TileMill?

I am trying to create a basemap in tilemill. Very new to this software. When I add the label styling for the roads, it adds the name several times. Is there a way to have it only place the label on ...
0
votes
1answer
24 views

Pattern styled polygons in Tilemill

I'm just learning CartoCSS with Tilemill. I've got a really simple requirement for styling a polygon but cannot find any hint nowhere. What is the code for styling simple polygon fills e.g. can be ...
0
votes
1answer
65 views

Highlight polygon on hover and click in TileMill

I have created a MapBox.js map with several layers of polygons each with hover/click interactivity to show attributes about each polygon. I want the polygons to become highlighted upon a user ...
0
votes
1answer
132 views

TileMill: Can't use both background-color and background-image?

Very new to TileMill and am working on my first project. I'm using a pattern image to enhance some areas on the map, water being an example. I've added the pattern to the water areas on my layers, ...