block by wboykinm 4370478

CartoDB Runtime Style

Full Screen

index.html

<!DOCTYPE html>
<html>
<head>
    <title>CartoDB Runtime</title>
    <style>
      html, body, #cartodb-map {
        height: 100%;
        padding: 0;
        margin: 0;
      }
    </style>
    <link rel="stylesheet" href="//geosprocket.com/assets/leaflet/dist/leaflet.css" />
    <!--[if lte IE 8]><link rel="stylesheet" href="//geosprocket.com/assets/leaflet/dist/leaflet.ie.css" /><![endif]-->

    <script src="//libs.cartocdn.com/cartodb.js/v2/cartodb.js"></script>
  
    <script>
	var map;
	function init(){
	  // initiate leaflet map
	  map = new L.Map('cartodb-map', { 
	    center: [34.885,-3.032],
	    zoom: 8
	  })
	
	  L.tileLayer('https://tiles.mapbox.com/v3/landplanner.map-a0wbwf43/{z}/{x}/{y}.png', {
	    attribution: 'Mapbox <a href="//mapbox.com/about/maps" target="_blank">Terms &amp; Feedback</a>'
	  }).addTo(map);
	
	  var layerUrl = '//dai.cartodb.com/api/v1/viz/11371/viz.json';
	  var layerOptions = {
	        query: "SELECT * FROM ag_2011_commune3 where mean_jache > 0",
	        tile_style: "#ag_2011_commune3{line-color: #FFF;line-opacity: 1;line-width: 1;polygon-opacity: 0.8;}#ag_2011_commune3[mean_jache <= 2.26312]{polygon-fill: #B10026;}#ag_2011_commune3[mean_jache<=1.19784363636] {polygon-fill: #E31A1C;}#ag_2011_commune3 [ mean_jache <= 0.778073210526]{polygon-fill: #FC4E2A;}#ag_2011_commune3 [ mean_jache <= 0.4677762] {polygon-fill: #FD8D3C;}#ag_2011_commune3 [ mean_jache <= 0.29674792] {polygon-fill: #FEB24C;}#ag_2011_commune3 [ mean_jache <= 0.0] {polygon-fill: #FFFFB2;}"
		}
	  	cartodb.createLayer(map, layerUrl, layerOptions)
	   		.on('done', function(layer) {
	    			map.addLayer(layer);
	  		})
	  		.on('error', function() {
	  		    //log the error
	  		});
        L.tileLayer('https://tiles.mapbox.com/v3/landplanner.map-r0hrxb15/{z}/{x}/{y}.png').addTo(map);
		}
		
		
	    </script>
	
</head>
<body onload="init()">
	<div id="cartodb-map"></div>
</body>

</html>