Heatmap coding
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.
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Will White on 15 Dec, 2011 06:37 PM
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.
3 Posted by grensburg on 16 Dec, 2011 09:46 AM
Thanks
grensburg closed this discussion on 16 Dec, 2011 09:47 AM.