Skip to content

Commit e49df44

Browse files
committed
update activity
1 parent 5b56e8f commit e49df44

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

activity_03-01.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ In this activity you'll be using CartoCSS and TileMill to make a choropleth map
3131
polygon-fill:#ae8;
3232
}`<br /><br />These style description give the map it's current look, but there are many properties of the polygon's fill and outline that can be edited. You can access the built-in CartoCSS reference by click the curly-brace button on that vertical stack of buttons mentioned earlier. Additionally, Mapbox includes the [reference](https://github.com/mapbox/carto/blob/master/docs/latest.md) on their GitHub page along with [several examples](https://www.mapbox.com/tilemill/docs/crashcourse/styling/) in the TileMill documentation on their website.<img src="https://maptastik.github.com/os-webmap-workshop/images/tm-ref1.png" width=100% />
3333
14. Let's change some properties. Change:<br /><br />`line-color:#594;` to `line-color:#000000;`<br />and<br />`polygon-fill:#ae8;` to `polygon-fill:#2980b9;`.<br /><br />Click **Save**. If all is correct, you should have a map of census tracts in Lucas County, OH with a blue fill and black borders.<br /><img src="https://maptastik.github.com/os-webmap-workshop/images/tm-map7.png" width=100% />
34+
15. Not too shabby! Way better than clicking through tons of dialog boxes. But this is a pretty boring map. Let's map those Hungarians! With CartoCSS we can assign styles to features that meet certain criteria. This is called conditional formatting. In this case we're going to apply conditional formatting to the fill of the tracts based on our **p_hung** field values.<br /><br />We're going to need to classify our **p_hung** field to create our choropleth map. TileMill is not a GIS and will not automatically create classification schemes based on your data. You'll have to do that in QGIS, ArcGIS, or by some other means. For the sake of this activity, I've created a classification scheme you can use. You may, of course, create your own. My scheme:<br>Class 1: <1<br>Class 2: 1-3.9<br>Class 3: 4-6.9<br>Class 4: 7-9.9<br>Class 5: >=10
35+
16. We're almost ready to apply this classification scheme to the map. But first, it would be good to get a color scheme. Rather than make one up, let's use [ColorBrewer2](http://colorbrewer2.org/). You have a lot of freedom here to pick your colors, but make sure that under the *Nature of your data* you select **sequential**. This will help ensure that you select a color scheme appropriate for the data. Also, make sure to switch from HEX to and RGB colorspace. TileMill can handle both, but it handles transparency better with RGB. My scheme:<br>Class 1: 255,255,204<br>Class 2: 194,230,153<br>Class 3: 120,198,121<br>Class 4: 49,163,84<br>Class 5: 0,104,55<br><img src="https://maptastik.github.com/os-webmap-workshop/images/tm-cb1.png" width=100% />
36+
17. Let's make this choropleth happen! Go ahead and just delete<br><br>`polygon-opacity:1;
37+
polygon-fill:#2980b9;`<br><br>We don't need them as they are.
38+
18. We can now apply our conditional formatting. Let's try it by just applying fill to those tracts with less than 1% of the population claiming Hungarian ancestry. Underneath `line-width: 0.5` add:<br><br>`[p_hung<1] {polygon-fill: rgb(255,255,204);}`<br><br>Click **Save**. If there are no syntax errors, you should see that only a few census tracts have been filled in. The rest are transparent because they have no polygon-fill value at the moment. We'll change that next.<br><img src="https://maptastik.github.com/os-webmap-workshop/images/tm-map8.png" width=100% />

images/tm-cb1.png

350 KB
Loading

images/tm-map8.png

67 KB
Loading

0 commit comments

Comments
 (0)