CartoCSS is a CSS-like language used in TileMill and Mapbox Studio Classic to style features.

learn more… | top users | synonyms

30
votes
3answers
11k 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 ...
15
votes
0answers
821 views

Converting from SLD to Carto CSS? [closed]

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 ...
9
votes
1answer
239 views

What is the future of CartoCSS (i.e. does it have one)? [closed]

MapBox recently announced that they would be moving away from CartoCSS towards a completely visual interface. Apparently the new style sheets that underlay that UI will be JSON based, so despite the ...
5
votes
2answers
277 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 {...
4
votes
1answer
260 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 ...
4
votes
1answer
792 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
282 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
1k 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 ...
3
votes
1answer
353 views

How to render tm2 projects

What are the options for rendering tm2 projects? As far as I know the open source Mapbox tm2 projects have proprietary data sources (like OSM Bright 2), thus they are of little use, but some other ...
3
votes
1answer
141 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
65 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
88 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'. ...
2
votes
2answers
496 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 ...
2
votes
1answer
23 views

What is the :: notation in CartoCSS?

I've been designing some tilesets in Mapbox Studio Classic and I keep seeing the :: notation in styles that Mapbox has created. What does that mean? Are there only specific values that can be put ...
2
votes
2answers
105 views

Mapbox Natural earth map disappears on zooms 0 & 1

As the title says, I'm currently using mapbox to create a little atlas app the issue is whenever I zoom out to anything lower than zoom level 2, the map dissappears with the map background being the ...
2
votes
1answer
1k views

Including chart based on fields in CartoDB infowindow?

I would like to make graphs, pie charts, etc based on fields in my table within my infowindows. Is there a way to accomplish this?
2
votes
1answer
165 views

CartoCSS: labels along inside of polygon boundary

I'm using CartoCSS to render maps that include large polygons (like national parks). At higher zoom levels I want labels along the inside of the polygon boundaries, like in OpenStreetMap: I ...
2
votes
2answers
519 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 text-...
2
votes
2answers
283 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
40 views

Why are point-files cut at tiles-borders?

I'm placing a SVG in Tilemill via a point with lat and long. So far that works great but when the tile the point is located in ends, the image is not rendered. Is this a bug? Can I do something ...
2
votes
1answer
87 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. ...
2
votes
1answer
211 views

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

I have LineStrings in a GeoJSON files, in example: {"type":"Feature","geometry":{"type":"LineString","coordinates":[[8.5918904,46.6325099,0],[8.5984267,46.6184961,0]]},"properties":{"name":"...
2
votes
1answer
591 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 ...
2
votes
2answers
196 views

How to generate 512x512 map tiles (2x resolution for retina displays)

I'm looking for a method to produce 512x512 pixels map tiles using CartoCSS and Mapnik, for example exactly as CardoDB does for its base maps (here below a 256x256 map tile vs its correspondent ...
2
votes
1answer
35 views

TileMill : set minzoom to layers?

i found in this post: CartoCSS layer visibility a solution to set a layer not visible for some zoom levels. But in https://github.com/gravitystorm/openstreetmap-carto it seems that a minzoom ...
2
votes
1answer
162 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 ...
2
votes
1answer
81 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 ...
2
votes
2answers
215 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
2answers
329 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 ...
2
votes
1answer
366 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
436 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
134 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
129 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 ...
2
votes
1answer
87 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
89 views

Creating weighted lines on map in CartoDB

I am trying to illustrate global trade flows within CartoDb. Flows are visualized by a line connecting two lat/long points on a map. The size of the flow would be represented by the width of the line. ...
1
vote
1answer
90 views

What OSM information to use for low zoom levels to get a style similar to MapQuest

I am building an outdoor map of Europe. Everything looks pretty nice when zoomed in. But when I am zoomed out, my map looks pretty boring. Most parts are white. In low zoom levels I display polygons ...
1
vote
1answer
513 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
1answer
307 views

osm2pgsql vs imposm rendering performance

Is there any difference in rendering performance between using a osm2pgsql vs imposm imported PostGIS DB in Mapnik? Or asking it differently, is there any downside of using imposm if I only want to ...
1
vote
1answer
108 views

CartoCSS: building polygon by tag

I'm using MapBox Studio to create a personalized map for slums. In OSM we have many polygons representing buildings and I need to style them according to their "building" tag. For example, the ...
1
vote
3answers
68 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
669 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
1answer
480 views

Carto CSS variables

Does anyone know whether it's possible to use a variable within an attribute selector. For example I define my variable at the top of the file: @lowZoomMax: 9; And then reference it as follows: #...
1
vote
2answers
1k 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
2answers
24 views

Change Carto basemap font size?

I'm using the CartoDB static Maps API. I need to change the font size of the street names. E.g. in the image below the street name "Stanhope Road" needs to be bigger. Here's what my Json config ...
1
vote
1answer
13 views

How to modify mapnik's buffer-size by kosmtik's localconfig.json/.js?

I want to override mapnik's buffer-size in kosmtik. How to override it in localconfig.json/.js?
1
vote
1answer
49 views

Can you use variables in URI field in cartodb CSS?

I am wanting to use a different marker-file based on a value returned via SQL in cartodb. I am wanting todo something like marker-file: url('[icon]'); Where the value in [icon] is a full URL to a ...
1
vote
1answer
71 views

CartoDB toggle buttons not working with my data?

We are taking CartoDB data for this Canadian election map -- http://cdb.io/1TabLyz -- to create a version that adds toggle buttons to filter by political party. However, the buttons only work ...
1
vote
1answer
207 views

External font in CartoCSS

I want to use a non CartoDB-installed typeface (one from typography.com) for the place labels (closer than 14z) on the map at http://outgoingnyc.com. So far if I try to do it in the css, it fails (...
1
vote
1answer
118 views

Torque map: dates by year; year in slider text

I would like to put the year in the slider text and for the data to be scrolled through via year. Apparently it was working until three weeks ago, and now doesn't. In particular the slider now ...
1
vote
1answer
104 views

CartoCSS: Filter by json field

In a MapBox Studio project of mine, I have field values that are stored as JSON values. My features all have attributes like: id 48545756 meta {} relations [] tags {"access":"forestry","highway":"...