|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<title>HTML Template | CartoDB</title> |
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> |
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> |
|
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" /> |
|
|
|
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" /> |
|
|
|
<style type="text/css"> |
|
html, body, #map { |
|
height: 100%; |
|
margin: 0; |
|
padding: 0; |
|
} |
|
#cartocss { |
|
position: absolute; |
|
right: 20px; |
|
top: 20px; |
|
} |
|
#sql { |
|
position: absolute; |
|
right: 292px; |
|
top: 20px; |
|
} |
|
#legend { |
|
position: absolute; |
|
left: 40px; |
|
top: 0; |
|
} |
|
/*BUTTON STYLES*/ |
|
.layer_selector { |
|
background: rgba(255,255,255,0.9); |
|
border: 1px solid #999; |
|
border-radius: 5px; |
|
font-family: 'Unica One', sans-serif; |
|
font-size: 13px; |
|
padding: 0; |
|
text-align: center; |
|
width: 250px; |
|
} |
|
.layer_selector > p { |
|
border-bottom: 1px solid #999; |
|
padding: 5px 10px; |
|
text-transform: uppercase; |
|
} |
|
.layer_selector ul { |
|
padding: 0; margin: 0; |
|
list-style-type: none; |
|
} |
|
.layer_selector li { |
|
color: #444; |
|
cursor: pointer; |
|
padding: 10px 20px; |
|
} |
|
.layer_selector li:not(:last-child) { |
|
border-bottom: 1px solid #999; |
|
} |
|
.layer_selector li:hover { |
|
background-color: #a8ddb5; |
|
cursor: pointer; |
|
} |
|
.layer_selector li.selected { |
|
background-color: #7bccc4; |
|
} |
|
/*LEGEND STYLES*/ |
|
.legend { |
|
background: rgba(255,255,255,0.9); |
|
border: 1px solid #999; |
|
border-radius: 5px; |
|
font-family: 'Unica One', sans-serif; |
|
font-size: 13px; |
|
margin: 15px; |
|
padding: 5px; |
|
text-align: center; |
|
width: 270px; |
|
z-index: 100; |
|
} |
|
.legend .legend-title { |
|
text-align: center; |
|
margin-bottom: 10px; |
|
font-family: 'Unica One', sans-serif; |
|
text-transform: uppercase; |
|
} |
|
.legend .legend-scale ul { |
|
font-family: 'Unica One', sans-serif; |
|
margin: 0; |
|
padding: 0; |
|
float: left; |
|
list-style: none; |
|
} |
|
.legend .legend-scale ul li { |
|
display: block; |
|
float: left; |
|
width: 50px; |
|
margin-bottom: 6px; |
|
text-align: right; |
|
font-size: 80%; |
|
list-style: none; |
|
} |
|
.legend ul.legend-labels li span { |
|
display: block; |
|
float: left; |
|
height: 15px; |
|
width: 55px; |
|
margin: 8px; |
|
} |
|
.legend .legend-source { |
|
font-family: 'Unica One', sans-serif; |
|
font-size: 70%; |
|
color: #999; |
|
clear: both; |
|
} |
|
.legend a { |
|
color: #777; |
|
} |
|
</style> |
|
|
|
<!-- SQL TEMPLATE --> |
|
<script type='sql/text' id='sql'> |
|
SELECT *, 100 * awater / ST_Area(the_geom::geography) perc_water |
|
FROM tl_2014_census_tracts |
|
</script> |
|
|
|
<!-- SIMPLE VIS CSS --> |
|
<style type='cartocss/text' id='simple'> |
|
/** simple visualization */ |
|
#tl_2014_census_tracts{ |
|
polygon-fill: #5CA2D1; |
|
polygon-opacity: 0.7; |
|
line-color: #FFF; |
|
line-width: 0.25; |
|
line-opacity: 1; |
|
} |
|
</style> |
|
|
|
<!-- CHOROPLETH CSS --> |
|
<style type='cartocss/text' id='choropleth'> |
|
/** choropleth visualization */ |
|
#tl_2014_census_tracts{ |
|
polygon-fill: #FFFFCC; |
|
polygon-opacity: 0.8; |
|
line-color: #FFF; |
|
line-width: 0; |
|
line-opacity: 1; |
|
} |
|
#tl_2014_census_tracts [ perc_water <= 100.829766103904] { |
|
polygon-fill: #253494; |
|
} |
|
#tl_2014_census_tracts [ perc_water <= 6.89127773835036] { |
|
polygon-fill: #2C7FB8; |
|
} |
|
#tl_2014_census_tracts [ perc_water <= 1.99990433083773] { |
|
polygon-fill: #41B6C4; |
|
} |
|
#tl_2014_census_tracts [ perc_water <= 0.782021558262898] { |
|
polygon-fill: #A1DAB4; |
|
} |
|
#tl_2014_census_tracts [ perc_water <= 0.258319771503945] { |
|
polygon-fill: #FFFFCC; |
|
} |
|
</style> |
|
|
|
</head> |
|
<body> |
|
<div id="map"></div> |
|
<!-- ADD BUTTONS --> |
|
<div id="cartocss" class="layer_selector"> |
|
<p>Layers</p> |
|
<ul> |
|
<li data="choropleth">Water Density Choropleth</li> |
|
<li data="simple">Simple County Map</li> |
|
</ul> |
|
</div> |
|
|
|
<!-- LEGENDS --> |
|
<div id="legend" class='legend'> |
|
<div class='legend-title'>Water Density x Census (2014)</div> |
|
<hr> |
|
<div class='legend-scale'> |
|
<ul class='legend-labels'> |
|
<li><span style='background:#FFFFCC;'></span> < 0.2 %</li> |
|
<li><span style='background:#A1DAB4;'></span></li> |
|
<li><span style='background:#41B6C4;'></span></li> |
|
<li><span style='background:#2C7FB8;'></span></li> |
|
<li><span style='background:#253494;'></span> < 100 %</li> |
|
</ul> |
|
</div> |
|
<div class='legend-source'>Source: <a href="http://www.census.gov/geo/maps-data/">US Census Bureau</a></div> |
|
</div> |
|
|
|
<!-- include cartodb.js library --> |
|
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script> |
|
|
|
<!-- place your code between the script tags below --> |
|
<script src="main.js"></script> |
|
</body> |
|
</html> |