Heatmap coding

grensburg's Avatar

grensburg

15 Dec, 2011 03:43 PM

Hallo, I started testing TileMill this week without ever learning CSS coding or any other coding before, and am trying to create a heatmap. First I opened a sqlite file that was converted from a shapefile with QGIS, then I went on to styling this file while looking at 2 different tutorials, http://blog.apps.chicagotribune.com/2011/03/08/making-maps-3/, https://gist.github.com/1370472.
I noticed that the way the conditions are written for coloring the polygons are different:

#results::fill[zoom>=0] {
  [percent_de > '70.0']{ polygon-fill:#0a66c2; }
  [percent_de > '60.0'][percent_de <= '70.0']{ polygon-fill:#2f53a5; }

and the other is

#counties { polygon-fill: #FFFFCC; }
#counties[popsqkm >= 5 ] { polygon-fill: #D9F0A3; }
#counties[popsqkm >= 10] { polygon-fill: #ADDD8E; }
#counties[popsqkm >= 25] { polygon-fill: #78C679; }
#counties[popsqkm >= 50] { polygon-fill: #41AB5D; }
#counties[popsqkm >= 100] { polygon-fill: #238443; }
#counties[popsqkm >= 500] { polygon-fill: #005A32; }

As you can see the first example is written like >'500' and the second is just >=5.

Can someone maybe explain which is the better style of coding.

  1. Support Staff 2 Posted by Will White on 15 Dec, 2011 06:37 PM

    Will White's Avatar

    You would use quotes if the attribute value is a string and you leave the quotes out if the attribute is an integer. Integer attributes are shown in green text in the feature inspector.

    You can see some of the green values in this tutorial.

  2. 3 Posted by grensburg on 16 Dec, 2011 09:46 AM

    grensburg's Avatar

    Thanks

  3. grensburg closed this discussion on 16 Dec, 2011 09:47 AM.

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

25 May, 2013 09:12 AM
25 May, 2013 08:30 AM
25 May, 2013 01:00 AM
25 May, 2013 12:58 AM
25 May, 2013 12:20 AM