Skip to content

Instantly share code, notes, and snippets.

@ian29
Created October 7, 2013 19:56
Show Gist options
  • Save ian29/6873905 to your computer and use it in GitHub Desktop.
Save ian29/6873905 to your computer and use it in GitHub Desktop.

Issue #2: My color scheme isn’t that great. How do I make it better?

Making your color scheme systematic is probably the best way to get a good-looking palette. It's not pure science - so dont just plug in numbers, but structured relationships between colors definitely makes for a more pleasing map. You can use any number color functions available to CartoCSS. For categorized features, I like using spin(), for getting different hues but maintaining the exact same lightness and saturation.

As for data steps there a number of statistical + geographic approaches (jenks is popular, and QGIS will calculate this for you), but I think for non-scientific maps like these, it's really just about what represents the data most effectively at a glance - which is to say trial and error.

I used a quasi-log scale for my NYC building-size map, which you can checkout here: https://github.com/mapbox/reinventgreen/blob/gh-pages/nyc-buildings/style.mss

Map: http://b.tiles.mapbox.com/v3/villeda.nyc-buildings.html#11/40.7098/-73.9709

Issue #3: The labels from the Streets layer are obscured by the building footprint colors.

Basically this means creating a composite of 2 maps designed at mapbox.com with your building map - 1 basemap with just the land + water, and 1 with just streets/labels, and sandwiching your building map in between.

Checkout the url here, you'll see 3 different map ids

http://a.tiles.mapbox.com/v3/villeda.map-p9nrg02k,villeda.sotm,villeda.map-5p7zbfw3.html#13/37.7694/-122.4146

Issue #4: The file size was too big for the 50MB limit that comes with a free MapBox account. How can newbies who don’t want to pay for a subscription make their map layer small enough to upload?

The biggest parameters that impact file-size are maximum zoom level and the size of your bounding box, followed by adding lots of data into your teaser/tooltips.

You can also adjust the tile image format from 24-bit to a lower-quality image, under "project settings". This might actually get you the most bang for you buck in terms of reducing file-size without reducing your max zoom level.

Issue #5: Adding a legend and teasers seemed to make my file too big for even the 250MB limit. Is this what happened? If so, is there a way to mitigate this?

Legends should contribute negligibly to your final mbtiles file-size, see previous answer.

Issue #6: My map turns grey when zoomed out. Is this a line-width problem?

You probably want to set zoom conditions on line-wdiths whenever you have lots of dense polygons like buildings. This will show

  • color patterns across the city at lower zoom levels
  • the nice definition added by outlines at higher zoom levels
  • a clean transition from no-outlines to outlines that does not distract users as they zoom in

Starting with no outline at all, you'll want to slowly increase line-widths as zoom level increases, so something along these lines - although I strongly suggest adapting this to your map.

[zoom<9] { line-width: 0; }
[zoom=9] { line-width: .1; }
[zoom=10] { line-width: .2; }
[zoom=11] { line-width: .3; }
[zoom=12] { line-width: .4; }
[zoom=13] { line-width: .5; }
[zoom=14] { line-width: .75; }
[zoom>14] { line-width: 1; }

See the advanced styling guide for more on how to set zoom conditions.

Additionally, make the line-color a darker version of the polygon color for cleaner outlines. I like to use the darken() function for this:

[YEAR_BUILT <= 1919] {
  polygon-fill:#fca9a9;
	line-color: darken(#fca9a9,10);
}

Issue #7: How do I get the color-scheme bar in my legend?

You can do this with some simple html/css. See the advanced legends guide for more here: http://www.mapbox.com/tilemill/docs/guides/advanced-legends/

Issue #8: I don’t even know what all the other issues are with this map! Please tell me what you see that needs to be fixed or could be better.

What makes these building maps such effective eye candy is all the colors, and how each color contrasts strongly with the basemap color. Using more than one hue will go a long way in adding vibrancy and making sure your oldest buildings mistaken or overlooked as gray background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment