block by michalskop 8819c01cdcb905f773cf

Panamanian presidential elections 2014

Full Screen

index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Elecciones presidenciales en Panamá 2014 - Panamanian presidential election 2014</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
	<script src="//code.jquery.com/jquery-1.8.2.min.js"></script>
	
	
	<script>
	  // see //leafletjs.com/reference.html
	  L_PREFER_CANVAS = true;
	</script>

	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
	 <!--[if lte IE 8]>
		 <link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
	 <![endif]-->
    <script src="//cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>

    <style type="text/css">

		html, body, #map {
		  width: 100%;
		  height: 100%;
		  margin: 0;
		  padding: 0;
		}
		.leaflet-tile-pane {
		  opacity: .3
		}
		.leaflet-container {
          background-color: #fff;
        }

    </style>
  </head>
  <body>
  
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Elecciones presidenciales en Panamá 2014 - Panamanian presidential election 2014</a>
        </div>
      </div>
    </div>
    
    <div style="position:fixed;top:50px;z-index:1000;">
      <div class="alert alert-info" >El <strong>tamaño</strong> de las burbujas representa el número de votantes, el <strong>color</strong> representa el ganador.<br/>
      <em>The <strong>size</strong> of bubbles represents number of voters, the <strong>color</strong> represents the winner.</em><br/>
      escrutado/counted: 95%</div>
    </div>    <div style="position:fixed;top:125px;z-index:1000;">
		<div class="alert alert-info" style="float:left;">
		    <svg height="20" width="20"><circle cx="10" cy="10" r="10" fill="#800080"></svg> Varela<br/>
		    <svg height="20" width="20"><circle cx="10" cy="10" r="10" fill="#20B2AA">></svg> Arias<br/>
		    <svg height="20" width="20"><circle cx="10" cy="10" r="10" fill='#00F'></svg> Navarro
		</div>
    </div>
    <div id="map" style="margin-top:40px;"></div>
    <script type="text/javascript">


		// Create the map
		var map = L.map('map',{zoomControl: false}).setView([8.61361,-79.971314], 8);
		map.addControl( L.control.zoom({position: 'topright'}) );
		
		// add an OpenStreetMap tile layer
		// also see //wiki.openstreetmap.org/wiki/Tiles
		//L.tileLayer('//{s}.tile.osm.org/{z}/{x}/{y}.png', {
		L.tileLayer('//{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', {
			attribution: 'CC-BY Michal Škop <a href="//kohovolit.eu">KohoVolit.eu</a> | &copy; <a href="//osm.org/copyright">OpenStreetMap</a> contributors'
		}).addTo(map);
		
		//add circles
		$.getJSON( "pa_president_2014.json", function (data) {
		    $.each(data.votes, function (index, value) {
		        
		        description = "<strong>" + value.district + "</strong> (" + value.population + ")<br>";
		        
		        tuples = [];
		        for (var key in value.votes) {
		          tuples.push([key,parseInt(value.votes[key])]);
		        }
		        
		        tuples.sort(function(a, b) {
                    a = a[1];
                    b = b[1];
                    return a < b ? 1 : (a > b ? -1 : 0);
                });
                for (i = 0; i < 4; i++) {
                  tmp = Math.round(parseInt(tuples[i][1]) / parseInt(value.population) * 100);
                  description += data.people[tuples[i][0]] + ": " +  tmp  +"%<br>";
                }
				/*sum = 0;
				$.each(value.description, function (i, v) {
				  tmp = Math.round(parseInt(v.value) / parseInt(value.population) * 1000) / 10;
				  description += v.name + ': ' +  tmp + '% (' + v.value + ' hlasů)<br>';
				  sum += parseInt(v.value)
				});
				tmp = Math.round((parseInt(value.population) - sum) / parseInt(value.population) * 1000) / 10;
				tmp2 = value.population - sum;
				description += "Ostatní: " + tmp + '% (' + tmp2 + ' hlasů)';*/
		    
		    
				circle = L.circle([value.lat, value.lng], Math.sqrt(parseInt(value.population)*1500), {
					color: data.colors[value.winner_class],
					fillColor: data.colors[value.winner_class],
					fillOpacity: 0.85,
					weight: 1,
				}).addTo(map);
				

				circle.bindPopup(description);
		  });
		});

	</script>
	
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-8592359-13', 'ocks.org');
      ga('send', 'pageview');

    </script> 
  </body>
</html>

districts.xml

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Table>
    <provincia>1</provincia>
    <distrito>0</distrito>
    <descripcion>BOCAS DEL TORO</descripcion>
  </Table>
  <Table>
    <provincia>1</provincia>
    <distrito>1</distrito>
    <descripcion>CHANGUINOLA</descripcion>
  </Table>
  <Table>
    <provincia>1</provincia>
    <distrito>2</distrito>
    <descripcion>CHIRIQUÍ GRANDE</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <distrito>0</distrito>
    <descripcion>AGUADULCE</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <distrito>1</distrito>
    <descripcion>ANTÓN</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <distrito>2</distrito>
    <descripcion>LA PINTADA</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <distrito>3</distrito>
    <descripcion>NATÁ</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <distrito>4</distrito>
    <descripcion>OLÁ</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <distrito>5</distrito>
    <descripcion>PENONOMÉ</descripcion>
  </Table>
  <Table>
    <provincia>3</provincia>
    <distrito>0</distrito>
    <descripcion>COLÓN</descripcion>
  </Table>
  <Table>
    <provincia>3</provincia>
    <distrito>1</distrito>
    <descripcion>CHAGRES</descripcion>
  </Table>
  <Table>
    <provincia>3</provincia>
    <distrito>2</distrito>
    <descripcion>DONOSO</descripcion>
  </Table>
  <Table>
    <provincia>3</provincia>
    <distrito>3</distrito>
    <descripcion>PORTOBELO</descripcion>
  </Table>
  <Table>
    <provincia>3</provincia>
    <distrito>4</distrito>
    <descripcion>SANTA ISABEL</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>0</distrito>
    <descripcion>ALANJE</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>1</distrito>
    <descripcion>BARÚ</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>2</distrito>
    <descripcion>BOQUERÓN</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>3</distrito>
    <descripcion>BOQUETE</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>4</distrito>
    <descripcion>BUGABA</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>5</distrito>
    <descripcion>DAVID</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>6</distrito>
    <descripcion>DOLEGA</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>7</distrito>
    <descripcion>GUALACA</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>8</distrito>
    <descripcion>REMEDIOS</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>9</distrito>
    <descripcion>RENACIMIENTO</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>10</distrito>
    <descripcion>SAN LORENZO</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>11</distrito>
    <descripcion>TOLÉ</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <distrito>12</distrito>
    <descripcion>SAN FÉLIX</descripcion>
  </Table>
  <Table>
    <provincia>5</provincia>
    <distrito>0</distrito>
    <descripcion>CHEPIGANA</descripcion>
  </Table>
  <Table>
    <provincia>5</provincia>
    <distrito>1</distrito>
    <descripcion>PINOGANA</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>0</distrito>
    <descripcion>CHITRÉ</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>1</distrito>
    <descripcion>LAS MINAS</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>2</distrito>
    <descripcion>LOS POZOS</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>3</distrito>
    <descripcion>OCÚ</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>4</distrito>
    <descripcion>PARITA</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>5</distrito>
    <descripcion>PESÉ</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <distrito>6</distrito>
    <descripcion>SANTA MARÍA</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>0</distrito>
    <descripcion>GUARARÉ</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>1</distrito>
    <descripcion>LAS TABLAS</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>2</distrito>
    <descripcion>LOS SANTOS</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>3</distrito>
    <descripcion>MACARACAS</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>4</distrito>
    <descripcion>PEDASÍ</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>5</distrito>
    <descripcion>POCRÍ</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <distrito>6</distrito>
    <descripcion>TONOSÍ</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>0</distrito>
    <descripcion>ARRAIJÁN</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>1</distrito>
    <descripcion>BALBOA</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>2</distrito>
    <descripcion>CAPIRA</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>3</distrito>
    <descripcion>CHAME</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>4</distrito>
    <descripcion>CHEPO</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>5</distrito>
    <descripcion>CHIMÁN</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>6</distrito>
    <descripcion>LA CHORRERA</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>7</distrito>
    <descripcion>PANAMÁ</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>8</distrito>
    <descripcion>SAN CARLOS</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>9</distrito>
    <descripcion>SAN MIGUELITO</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <distrito>11</distrito>
    <descripcion>TABOGA</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>0</distrito>
    <descripcion>ATALAYA</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>1</distrito>
    <descripcion>CALOBRE</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>2</distrito>
    <descripcion>CAÑAZAS</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>3</distrito>
    <descripcion>LA MESA</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>4</distrito>
    <descripcion>LAS PALMAS</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>5</distrito>
    <descripcion>MONTIJO</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>6</distrito>
    <descripcion>RÍO DE JESÚS</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>7</distrito>
    <descripcion>SAN FRANCISCO</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>8</distrito>
    <descripcion>SANTA FE</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>9</distrito>
    <descripcion>SANTIAGO</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>11</distrito>
    <descripcion>SONÁ</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <distrito>12</distrito>
    <descripcion>MARIATO</descripcion>
  </Table>
  <Table>
    <provincia>10</provincia>
    <distrito>0</distrito>
    <descripcion xml:space="preserve"> </descripcion>
  </Table>
  <Table>
    <provincia>11</provincia>
    <distrito>0</distrito>
    <descripcion>CÉMACO</descripcion>
  </Table>
  <Table>
    <provincia>11</provincia>
    <distrito>1</distrito>
    <descripcion>SAMBÚ</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>0</distrito>
    <descripcion>KANKINTÚ</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>1</distrito>
    <descripcion>KUSAPÍN</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>2</distrito>
    <descripcion>BESIKO</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>3</distrito>
    <descripcion>MIRONÓ</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>4</distrito>
    <descripcion>MÜNA</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>5</distrito>
    <descripcion>NOLE DÜIMA</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>6</distrito>
    <descripcion>ÑÜRUN</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>7</distrito>
    <descripcion>JIRONDAI</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <distrito>8</distrito>
    <descripcion>SANTA CATALINA O CALOVÉBORA (BLEDESHIA)</descripcion>
  </Table>
  <Table>
    <provincia>13</provincia>
    <distrito>0</distrito>
    <descripcion xml:space="preserve"> </descripcion>
  </Table>
  <Table>
    <provincia>14</provincia>
    <distrito>0</distrito>
    <descripcion xml:space="preserve"> </descripcion>
  </Table>
</NewDataSet>

geocoded_pa.csv

1,BOCAS DEL TORO,0,BOCAS DEL TORO,9.3333333,-82.25,"Bocas del Toro, Panamá"
1,BOCAS DEL TORO,1,CHANGUINOLA,9.4540539,-82.5077593,"Changuinola, Panamá"
1,BOCAS DEL TORO,2,CHIRIQUÍ GRANDE,8.95,-82.12,"Chiriquí Grande, Panamá"
2,COCLÉ,0,AGUADULCE,8.24,-80.54,"Aguadulce, Panamá"
2,COCLÉ,1,ANTÓN,8.4018641,-80.2711588,"Antón, Panamá"
2,COCLÉ,2,LA PINTADA,8.5933178,-80.4465594,"La Pintada, Panamá"
2,COCLÉ,3,NATÁ,8.33,-80.52,"Natá, Panamá"
2,COCLÉ,4,OLÁ,8.4232203,-80.6479524,"Olá, Panamá"
2,COCLÉ,5,PENONOMÉ,8.5186111,-80.3552778,"Penonomé, Panamá"
3,COLÓN,0,COLÓN,9.3333333,-79.9,"Colón, Panamá"
3,COLÓN,1,CHAGRES,9.121446,-80.1205256,"Chagres, Panamá"
3,COLÓN,2,DONOSO,9.149554,-80.306168,
3,COLÓN,3,PORTOBELO,9.55,-79.65,"Pertobelo, Panamá"
3,COLÓN,4,SANTA ISABEL,9.535121,-79.183006,"Santa Isabel, Panamá"
4,CHIRIQUÍ,0,ALANJE,8.4,-82.54,"Alanje, Panamá"
4,CHIRIQUÍ,1,BARÚ,8.404451,-82.864609,"Chiriquí, Panamá"
4,CHIRIQUÍ,2,BOQUERÓN,8.4929047,-82.5645687,"Boquerón, Panamá"
4,CHIRIQUÍ,3,BOQUETE,8.78,-82.44,"Boquete, Panamá"
4,CHIRIQUÍ,4,BUGABA,8.48,-82.62,"Bugaba, Panamá"
4,CHIRIQUÍ,5,DAVID,8.3930884,-82.3289111,"Chiriquí, Panamá"
4,CHIRIQUÍ,6,DOLEGA,8.5662901,-82.4129729,"Dolega, Panamá"
4,CHIRIQUÍ,7,GUALACA,8.53,-82.29,"Gualaca, Panamá"
4,CHIRIQUÍ,8,REMEDIOS,8.2310546,-81.8279011,"Remedios, Panamá"
4,CHIRIQUÍ,9,RENACIMIENTO,8.7457913,-82.7994194,"Renacimiento, Panamá"
4,CHIRIQUÍ,10,SAN LORENZO,8.3057463,-82.1019854,"San Lorenzo, Panamá"
4,CHIRIQUÍ,11,TOLÉ,8.25,-81.66,"Tolé, Panamá"
4,CHIRIQUÍ,12,SAN FÉLIX,8.2970411,-81.8716058,"San Felíx, Panamá"
5,DARIÉN,0,CHEPIGANA,8.301866,-78.054047,"Chepigana, Panamá"
5,DARIÉN,1,PINOGANA,8.139347,-77.6727219,"Pinogana, Panamá"
6,HERRERA,0,CHITRÉ,7.9666667,-80.4333333,"Chitré, Panamá"
6,HERRERA,1,LAS MINAS,7.8,-80.74,"Las Minas, Panamá"
6,HERRERA,2,LOS POZOS,7.7862146,-80.6451779,"Los Pozo, Panamá"
6,HERRERA,3,OCÚ,7.94,-80.78,"Ocú, Panamá"
6,HERRERA,4,PARITA,8,-80.51,"Parita, Panamá"
6,HERRERA,5,PESÉ,7.9069409,-80.6128175,"Pesé, Panamá"
6,HERRERA,6,SANTA MARÍA,8.1166667,-80.6666667,"Santa María, Panamá"
7,LOS SANTOS,0,GUARARÉ,7.82,-80.27,"Guararé, Panamá"
7,LOS SANTOS,1,LAS TABLAS,7.7666667,-80.2833333,"Las Tablas, Panamá"
7,LOS SANTOS,2,LOS SANTOS,7.93233,-80.416074,
7,LOS SANTOS,3,MACARACAS,7.73,-80.54,"Macaracas, Panamá"
7,LOS SANTOS,4,PEDASÍ,7.55,-80.0166667,"Pedasí, Panamá"
7,LOS SANTOS,5,POCRÍ,7.6589921,-80.1191296,"Pocrí, Panamá"
7,LOS SANTOS,6,TONOSÍ,7.4,-80.44,"Tonosí, Panamá"
8,PANAMÁ,0,ARRAIJÁN,8.95,-79.65,"Arraiján, Panamá"
8,PANAMÁ,1,BALBOA,8.95,-79.5666667,"Balboa, Panamá"
8,PANAMÁ,2,CAPIRA,8.75,-79.87,"Capira, Panamá"
8,PANAMÁ,3,CHAME,8.5843146,-79.8828828,"Chame, Panamá"
8,PANAMÁ,4,CHEPO,9.17,-79.1,"Chepo, Panamá"
8,PANAMÁ,5,CHIMÁN,8.7183656,-78.632781,"Chimán, Panamá"
8,PANAMÁ,6,LA CHORRERA,8.8792,-79.7822,"La Chorrera, Panamá"
8,PANAMÁ,7,PANAMÁ,8.9833333,-79.5166667,Panamá
8,PANAMÁ,8,SAN CARLOS,8.4833333,-79.95,"San Carlos, Panamá"
8,PANAMÁ,9,SAN MIGUELITO,9.033,-79.5,"San Miguelito, Panamá"
8,PANAMÁ,11,TABOGA,8.7871912,-79.5575342,"Isla de Taboga, Panamá"
9,VERAGUAS,0,ATALAYA,8.0401232,-80.9249212,"Atalaya, Panamá"
9,VERAGUAS,1,CALOBRE,8.32,-80.84,"Calobre, Panamá"
9,VERAGUAS,2,CAÑAZAS,8.32,-81.21,"Cañazas, Panamá"
9,VERAGUAS,3,LA MESA,8.15,-81.1833333,"La Mesa, Panamá"
9,VERAGUAS,4,LAS PALMAS,8.1366823,-81.455364,"Las Palmas, Panamá"
9,VERAGUAS,5,MONTIJO,7.9922222,-81.0544444,"Montijo, Panamá"
9,VERAGUAS,6,RÍO DE JESÚS,7.9819727,-81.166481,"Río de Jesús, Panamá"
9,VERAGUAS,7,SAN FRANCISCO,8.2393822,-80.9539475,"San Francisco, Panamá"
9,VERAGUAS,8,SANTA FE,8.5106415,-81.0782253,"Santa Fé, Panamá"
9,VERAGUAS,9,SANTIAGO,8.1,-80.9666667,"Santiago, Panamá"
9,VERAGUAS,11,SONÁ,8.0166667,-81.3166667,"Soná, Panamá"
9,VERAGUAS,12,MARIATO,7.2166667,-80.8833333,"Punta Mariato, Panamá"
10,COMARCA KUNA YALA,0, ,9.2403674,-78.2703951,"Guna Yala, Panamá"
11,COMARCA EMBERA,0,CÉMACO,8.428904,-77.611771,
11,COMARCA EMBERA,1,,8.014356,-78.217392,
12,COMARCA NGÄBE-BUGLÉ,0,KANKINTÚ,8.845022,-81.812872,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,1,KUSAPÍN,9.187853,-81.889057,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,2,BESIKO,8.551146,-82.085838,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,3,MIRONÓ,8.435017,-81.842079,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,4,MÜNA,8.451997,-81.646385,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,5,NOLE DÜIMA,8.446564,-81.790581,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,6,ÑÜRUN,8.54164,-81.386948,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,7,JIRONDAI,8.733077,-82.082062,"Ngäbe-Buglé, Panamá"
12,COMARCA NGÄBE-BUGLÉ,8,SANTA CATALINA O CALOVÉBORA (BLEDESHIA),8.841651,-81.214142,"Ngäbe-Buglé, Panamá"
13,C.KUNA DE MADUNGANDI,0, ,9.0917381,-78.3842227,"Madugandí, Panamá"
14,COMARCA KUNA DE WARGANDI,0, ,8.8615188,-77.973865,"Wargandí, Panamá"

pa_president_2014.json

{"colors": {"genaro-lopez-r": "#F00", "juan-jovane": "#888", "esteban-del-pueblo-rodriguez": "#888", "gerardo-el0chiricano-barroso": "#888", "jose-domingo-arias": "#20B2AA", "juan-carlos-navarro": "#00F", "juan-carlos-varela": "#800080"}, "people": ["JUAN CARLOS NAVARRO", "JOSE DOMINGO ARIAS", "JUAN CARLOS VARELA", "GENARO LOPEZ R.", "ESTEBAN DEL PUEBLO RODRIGUEZ", "JUAN JOVANE", "GERARDO EL CHIRICANO BARROSO"], "votes": [{"lat": "8.9833333", "district": "PANAM\u00c1, PANAM\u00c1", "id": 8.7, "lng": "-79.5166667", "votes": [107169, 146282, 154416, 1846, 204, 4022, 208], "population": 414147, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.033", "district": "SAN MIGUELITO, PANAM\u00c1", "id": 8.9, "lng": "-79.5", "votes": [39783, 65698, 60319, 921, 88, 1607, 86], "population": 168502, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.95", "district": "ARRAIJ\u00c1N, PANAM\u00c1", "id": 8.0, "lng": "-79.65", "votes": [25728, 37938, 42165, 497, 45, 997, 64], "population": 107434, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.3333333", "district": "COL\u00d3N, COL\u00d3N", "id": 3.0, "lng": "-79.9", "votes": [22048, 29364, 42494, 540, 61, 837, 61], "population": 95405, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.8792", "district": "LA CHORRERA, PANAM\u00c1", "id": 8.6, "lng": "-79.7822", "votes": [21697, 31429, 35023, 310, 68, 588, 78], "population": 89193, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.3930884", "district": "DAVID, CHIRIQU\u00cd", "id": 4.5, "lng": "-82.3289111", "votes": [24221, 24167, 30666, 235, 28, 355, 84], "population": 79756, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.1", "district": "SANTIAGO, VERAGUAS", "id": 9.9, "lng": "-80.9666667", "votes": [17462, 14748, 19121, 196, 33, 232, 38], "population": 51830, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.5186111", "district": "PENONOM\u00c9, COCL\u00c9", "id": 2.5, "lng": "-80.3552778", "votes": [14094, 12648, 22318, 249, 34, 132, 53], "population": 49528, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.4540539", "district": "CHANGUINOLA, BOCAS DEL TORO", "id": 1.1, "lng": "-82.5077593", "votes": [14965, 12307, 11190, 973, 81, 147, 54], "population": 39717, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.48", "district": "BUGABA, CHIRIQU\u00cd", "id": 4.4, "lng": "-82.62", "votes": [8583, 11666, 17489, 83, 19, 99, 35], "population": 37974, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.9666667", "district": "CHITR\u00c9, HERRERA", "id": 6.0, "lng": "-80.4333333", "votes": [7596, 7642, 17266, 52, 10, 74, 8], "population": 32648, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.4018641", "district": "ANT\u00d3N, COCL\u00c9", "id": 2.1, "lng": "-80.2711588", "votes": [6779, 7689, 14930, 222, 22, 87, 20], "population": 29749, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.24", "district": "AGUADULCE, COCL\u00c9", "id": 2.0, "lng": "-80.54", "votes": [4689, 8629, 12465, 76, 14, 146, 12], "population": 26031, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.75", "district": "CAPIRA, PANAM\u00c1", "id": 8.2, "lng": "-79.87", "votes": [6041, 8098, 9343, 102, 70, 49, 47], "population": 23750, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.404451", "district": "BAR\u00da, CHIRIQU\u00cd", "id": 4.1, "lng": "-82.864609", "votes": [6910, 7550, 8771, 129, 41, 77, 29], "population": 23507, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.17", "district": "CHEPO, PANAM\u00c1", "id": 8.4, "lng": "-79.1", "votes": [5126, 6272, 9903, 77, 31, 47, 29], "population": 21485, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.7666667", "district": "LAS TABLAS, LOS SANTOS", "id": 7.1, "lng": "-80.2833333", "votes": [5711, 6876, 7251, 33, 13, 49, 9], "population": 19942, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.93233", "district": "LOS SANTOS, LOS SANTOS", "id": 7.2, "lng": "-80.416074", "votes": [5889, 4346, 8203, 33, 6, 48, 10], "population": 18535, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.0166667", "district": "SON\u00c1, VERAGUAS", "id": 10.1, "lng": "-81.3166667", "votes": [5640, 8386, 4097, 28, 10, 37, 14], "population": 18212, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.5933178", "district": "LA PINTADA, COCL\u00c9", "id": 2.2, "lng": "-80.4465594", "votes": [3519, 5293, 7615, 143, 20, 21, 16], "population": 16627, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.2403674", "district": " , COMARCA KUNA YALA", "id": 10.0, "lng": "-78.2703951", "votes": [5373, 7629, 2633, 80, 15, 41, 18], "population": 15789, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.301866", "district": "CHEPIGANA, DARI\u00c9N", "id": 5.0, "lng": "-78.054047", "votes": [5152, 3724, 6090, 71, 26, 16, 16], "population": 15095, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.5662901", "district": "DOLEGA, CHIRIQU\u00cd", "id": 4.6, "lng": "-82.4129729", "votes": [4105, 3595, 5590, 18, 7, 42, 14], "population": 13371, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.5843146", "district": "CHAME, PANAM\u00c1", "id": 8.3, "lng": "-79.8828828", "votes": [2765, 3811, 6437, 53, 10, 42, 13], "population": 13131, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.451997", "district": "M\u00dcNA, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.4, "lng": "-81.646385", "votes": [8741, 1428, 1506, 188, 97, 12, 46], "population": 12018, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "7.94", "district": "OC\u00da, HERRERA", "id": 6.3, "lng": "-80.78", "votes": [2983, 1573, 7032, 48, 12, 12, 16], "population": 11676, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.4833333", "district": "SAN CARLOS, PANAM\u00c1", "id": 8.8, "lng": "-79.95", "votes": [2739, 2894, 5567, 51, 4, 20, 9], "population": 11284, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.1366823", "district": "LAS PALMAS, VERAGUAS", "id": 9.4, "lng": "-81.455364", "votes": [3567, 2716, 4744, 168, 18, 17, 19], "population": 11249, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.33", "district": "NAT\u00c1, COCL\u00c9", "id": 2.3, "lng": "-80.52", "votes": [2240, 3573, 5308, 34, 5, 34, 11], "population": 11205, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.9069409", "district": "PES\u00c9, HERRERA", "id": 6.5, "lng": "-80.6128175", "votes": [1253, 1551, 7330, 7, 3, 9, 5], "population": 10158, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.78", "district": "BOQUETE, CHIRIQU\u00cd", "id": 4.3, "lng": "-82.44", "votes": [3077, 2672, 3975, 45, 13, 49, 9], "population": 9840, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.32", "district": "CA\u00d1AZAS, VERAGUAS", "id": 9.2, "lng": "-81.21", "votes": [3439, 2051, 4075, 159, 28, 10, 13], "population": 9775, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.32", "district": "CALOBRE, VERAGUAS", "id": 9.1, "lng": "-80.84", "votes": [2925, 2604, 3361, 105, 18, 15, 6], "population": 9034, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.4", "district": "ALANJE, CHIRIQU\u00cd", "id": 4.0, "lng": "-82.54", "votes": [3109, 1837, 3707, 64, 3, 13, 9], "population": 8742, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.551146", "district": "BESIKO, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.2, "lng": "-82.085838", "votes": [5221, 1037, 2147, 139, 146, 18, 29], "population": 8737, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.15", "district": "LA MESA, VERAGUAS", "id": 9.3, "lng": "-81.1833333", "votes": [1938, 2831, 3596, 89, 6, 13, 6], "population": 8479, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.139347", "district": "PINOGANA, DARI\u00c9N", "id": 5.1, "lng": "-77.6727219", "votes": [3214, 2521, 2645, 35, 11, 9, 6], "population": 8441, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.5106415", "district": "SANTA FE, VERAGUAS", "id": 9.8, "lng": "-81.0782253", "votes": [3273, 1500, 3287, 249, 39, 13, 17], "population": 8378, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.82", "district": "GUARAR\u00c9, LOS SANTOS", "id": 7.0, "lng": "-80.27", "votes": [2302, 2425, 3081, 8, 4, 14, 5], "population": 7839, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.7457913", "district": "RENACIMIENTO, CHIRIQU\u00cd", "id": 4.9, "lng": "-82.7994194", "votes": [2064, 1419, 4049, 39, 24, 20, 19], "population": 7634, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.435017", "district": "MIRON\u00d3, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.3, "lng": "-81.842079", "votes": [4705, 851, 1773, 198, 51, 7, 20], "population": 7605, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "7.73", "district": "MACARACAS, LOS SANTOS", "id": 7.3, "lng": "-80.54", "votes": [2455, 1543, 3295, 12, 7, 3, 2], "population": 7317, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.25", "district": "TOL\u00c9, CHIRIQU\u00cd", "id": 5.1, "lng": "-81.66", "votes": [2620, 1404, 3245, 16, 11, 8, 5], "population": 7309, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.4929047", "district": "BOQUER\u00d3N, CHIRIQU\u00cd", "id": 4.2, "lng": "-82.5645687", "votes": [1671, 1697, 3666, 18, 8, 21, 5], "population": 7086, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.4", "district": "TONOS\u00cd, LOS SANTOS", "id": 7.6, "lng": "-80.44", "votes": [1777, 1854, 3389, 20, 3, 9, 8], "population": 7060, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.733077", "district": "JIRONDAI, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.7, "lng": "-82.082062", "votes": [3311, 1767, 1836, 52, 43, 8, 5], "population": 7022, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.2393822", "district": "SAN FRANCISCO, VERAGUAS", "id": 9.7, "lng": "-80.9539475", "votes": [2752, 1749, 2414, 66, 16, 5, 5], "population": 7007, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8", "district": "PARITA, HERRERA", "id": 6.4, "lng": "-80.51", "votes": [1197, 969, 4623, 4, 1, 10, 2], "population": 6806, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.845022", "district": "KANKINT\u00da, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.0, "lng": "-81.812872", "votes": [2805, 1587, 2133, 48, 79, 16, 14], "population": 6682, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.446564", "district": "NOLE D\u00dcIMA, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.5, "lng": "-81.790581", "votes": [3997, 702, 1466, 234, 51, 15, 28], "population": 6493, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.0401232", "district": "ATALAYA, VERAGUAS", "id": 9.0, "lng": "-80.9249212", "votes": [2130, 1777, 2527, 15, 1, 30, 4], "population": 6484, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.187853", "district": "KUSAP\u00cdN, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.1, "lng": "-81.889057", "votes": [2943, 2178, 1154, 117, 15, 17, 6], "population": 6430, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.54164", "district": "\u00d1\u00dcRUN, COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.6, "lng": "-81.386948", "votes": [3899, 814, 1278, 230, 33, 10, 24], "population": 6288, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "7.7862146", "district": "LOS POZOS, HERRERA", "id": 6.2, "lng": "-80.6451779", "votes": [1411, 764, 4010, 2, 7, 4, 6], "population": 6204, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.3333333", "district": "BOCAS DEL TORO, BOCAS DEL TORO", "id": 1.0, "lng": "-82.25", "votes": [2438, 2139, 1341, 82, 34, 17, 3], "population": 6054, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.95", "district": "CHIRIQU\u00cd GRANDE, BOCAS DEL TORO", "id": 1.2, "lng": "-82.12", "votes": [2683, 1698, 1571, 54, 13, 15, 11], "population": 6045, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "9.121446", "district": "CHAGRES, COL\u00d3N", "id": 3.1, "lng": "-80.1205256", "votes": [1745, 1811, 2404, 27, 7, 11, 1], "population": 6006, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.1166667", "district": "SANTA MAR\u00cdA, HERRERA", "id": 6.6, "lng": "-80.6666667", "votes": [1695, 1166, 2846, 11, 2, 10, 1], "population": 5731, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.8", "district": "LAS MINAS, HERRERA", "id": 6.1, "lng": "-80.74", "votes": [1418, 1012, 3093, 9, 7, 3, 10], "population": 5552, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.55", "district": "PORTOBELO, COL\u00d3N", "id": 3.3, "lng": "-79.65", "votes": [1194, 1920, 2311, 34, 17, 18, 5], "population": 5499, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "9.149554", "district": "DONOSO, COL\u00d3N", "id": 3.2, "lng": "-80.306168", "votes": [1942, 1327, 1992, 85, 10, 11, 6], "population": 5373, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.53", "district": "GUALACA, CHIRIQU\u00cd", "id": 4.7, "lng": "-82.29", "votes": [1844, 1170, 2317, 7, 3, 11, 11], "population": 5363, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.9922222", "district": "MONTIJO, VERAGUAS", "id": 9.5, "lng": "-81.0544444", "votes": [2003, 1749, 1264, 8, 8, 7, 1], "population": 5040, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "7.9819727", "district": "R\u00cdO DE JES\u00daS, VERAGUAS", "id": 9.6, "lng": "-81.166481", "votes": [1988, 1802, 890, 22, 0, 9, 1], "population": 4712, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.4232203", "district": "OL\u00c1, COCL\u00c9", "id": 2.4, "lng": "-80.6479524", "votes": [1250, 1337, 1975, 19, 3, 6, 3], "population": 4593, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.428904", "district": "C\u00c9MACO, COMARCA EMBERA", "id": 11.0, "lng": "-77.611771", "votes": [2185, 1117, 574, 12, 13, 6, 2], "population": 3909, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "9.535121", "district": "SANTA ISABEL, COL\u00d3N", "id": 3.4, "lng": "-79.183006", "votes": [1295, 1032, 1280, 18, 5, 14, 1], "population": 3645, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.2970411", "district": "SAN F\u00c9LIX, CHIRIQU\u00cd", "id": 5.2, "lng": "-81.8716058", "votes": [1505, 802, 1288, 9, 5, 3, 4], "population": 3616, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "7.2166667", "district": "MARIATO, VERAGUAS", "id": 10.2, "lng": "-80.8833333", "votes": [1044, 625, 1655, 5, 25, 2, 2], "population": 3358, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.55", "district": "PEDAS\u00cd, LOS SANTOS", "id": 7.4, "lng": "-80.0166667", "votes": [779, 1265, 1093, 6, 1, 5, 2], "population": 3151, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.3057463", "district": "SAN LORENZO, CHIRIQU\u00cd", "id": 5.0, "lng": "-82.1019854", "votes": [902, 638, 1578, 8, 4, 7, 8], "population": 3145, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "7.6589921", "district": "POCR\u00cd, LOS SANTOS", "id": 7.5, "lng": "-80.1191296", "votes": [847, 1126, 1061, 5, 7, 5, 3], "population": 3054, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.2310546", "district": "REMEDIOS, CHIRIQU\u00cd", "id": 4.8, "lng": "-81.8279011", "votes": [1194, 728, 1003, 13, 3, 4, 5], "population": 2950, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.841651", "district": "SANTA CATALINA O CALOV\u00c9BORA (BLEDESHIA), COMARCA NG\u00c4BE-BUGL\u00c9", "id": 12.8, "lng": "-81.214142", "votes": [979, 499, 490, 147, 43, 12, 8], "population": 2178, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.7183656", "district": "CHIM\u00c1N, PANAM\u00c1", "id": 8.5, "lng": "-78.632781", "votes": [499, 716, 833, 6, 3, 1, 1], "population": 2059, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}, {"lat": "8.95", "district": "BALBOA, PANAM\u00c1", "id": 8.1, "lng": "-79.5666667", "votes": [644, 764, 498, 21, 1, 4, 3], "population": 1935, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "9.0917381", "district": " , C.KUNA DE MADUNGANDI", "id": 13.0, "lng": "-78.3842227", "votes": [674, 711, 370, 12, 5, 4, 3], "population": 1779, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.7871912", "district": "TABOGA, PANAM\u00c1", "id": 9.1, "lng": "-79.5575342", "votes": [410, 590, 488, 0, 0, 6, 1], "population": 1495, "winner": "JOSE DOMINGO ARIAS", "winner_class": "jose-domingo-arias"}, {"lat": "8.014356", "district": ", COMARCA EMBERA", "id": 11.1, "lng": "-78.217392", "votes": [573, 296, 363, 17, 0, 1, 1], "population": 1251, "winner": "JUAN CARLOS NAVARRO", "winner_class": "juan-carlos-navarro"}, {"lat": "8.8615188", "district": " , COMARCA KUNA DE WARGANDI", "id": 14.0, "lng": "-77.973865", "votes": [364, 116, 427, 14, 1, 0, 2], "population": 924, "winner": "JUAN CARLOS VARELA", "winner_class": "juan-carlos-varela"}]}

provinces.xml

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Table>
    <provincia>1</provincia>
    <descripcion>BOCAS DEL TORO</descripcion>
  </Table>
  <Table>
    <provincia>2</provincia>
    <descripcion>COCLÉ</descripcion>
  </Table>
  <Table>
    <provincia>3</provincia>
    <descripcion>COLÓN</descripcion>
  </Table>
  <Table>
    <provincia>4</provincia>
    <descripcion>CHIRIQUÍ</descripcion>
  </Table>
  <Table>
    <provincia>5</provincia>
    <descripcion>DARIÉN</descripcion>
  </Table>
  <Table>
    <provincia>6</provincia>
    <descripcion>HERRERA</descripcion>
  </Table>
  <Table>
    <provincia>7</provincia>
    <descripcion>LOS SANTOS</descripcion>
  </Table>
  <Table>
    <provincia>8</provincia>
    <descripcion>PANAMÁ</descripcion>
  </Table>
  <Table>
    <provincia>9</provincia>
    <descripcion>VERAGUAS</descripcion>
  </Table>
  <Table>
    <provincia>10</provincia>
    <descripcion>COMARCA KUNA YALA</descripcion>
  </Table>
  <Table>
    <provincia>11</provincia>
    <descripcion>COMARCA EMBERA</descripcion>
  </Table>
  <Table>
    <provincia>12</provincia>
    <descripcion>COMARCA NGÄBE-BUGLÉ</descripcion>
  </Table>
  <Table>
    <provincia>13</provincia>
    <descripcion>C.KUNA DE MADUNGANDI</descripcion>
  </Table>
  <Table>
    <provincia>14</provincia>
    <descripcion>COMARCA KUNA DE WARGANDI</descripcion>
  </Table>
  <Table>
    <provincia>15</provincia>
    <descripcion>VOTO EN EL EXTRANJERO</descripcion>
  </Table>
</NewDataSet>

results2json.py

# -*- coding: utf-8 -*-

# python 3.4

import xml.etree.ElementTree as ET
import json
import csv
from slugify import slugify

#http://hdxmltep.blob.core.windows.net/xml/Pres_x_Distritos.xml

# import districts
districts = {}
dReader = csv.reader(open('geocoded_pa.csv'))
for row in dReader:
  try:
    districts[row[0]]
  except:
    districts[row[0]] = {}
  districts[row[0]][row[2]] = {'province_id':row[0],'province_name':row[1],'district_id':row[2],'district_name':row[3],'lat':row[4],'lng':row[5]}
#print(districts)

def people2number(name):
  if name == 'JUAN CARLOS NAVARRO':
    return 0
  if name == 'JOSE DOMINGO ARIAS': 
    return 1
  if name == 'JUAN CARLOS VARELA': 
    return 2
  if name == 'GENARO LOPEZ R.': 
    return 3
  if name == 'ESTEBAN DEL PUEBLO RODRIGUEZ': 
    return 4
  if name == 'JUAN JOVANE': 
    return 5
  if name == 'GERARDO EL CHIRICANO BARROSO': 
    return 6

people = ['JUAN CARLOS NAVARRO','JOSE DOMINGO ARIAS','JUAN CARLOS VARELA','GENARO LOPEZ R.','ESTEBAN DEL PUEBLO RODRIGUEZ','JUAN JOVANE','GERARDO EL CHIRICANO BARROSO']
colors = {
  'juan-carlos-navarro':'#00F',
  'jose-domingo-arias': '#20B2AA',
  'juan-carlos-varela': '#800080',
  'genaro-lopez-r': '#F00',
  'esteban-del-pueblo-rodriguez':"#888",
  'juan-jovane':"#888",
  'gerardo-el0chiricano-barroso': "#888"
}

#results
tree = ET.parse('results_95.xml')
root = tree.getroot()
for child in root:
  if child.tag == 'Table2':
    province = child.find('provincia').text
    district = child.find('distrito').text
    votes = int(child.find('votos').text)
    name = child.find('alias').text
    try:
      districts[province][district]['votes']
    except:
      districts[province][district]['votes'] = [None] * 7
    #print(people2number(name))
    districts[province][district]['votes'][people2number(name)] = votes
    
#print(districts)

def winner(people,votes):
  for i in range(0,7):
    if votes[i] == max(votes):
      return people[i]

#slugify
out = {}
out['people'] = people
out['colors'] = colors
#out['votes'] = []
items = []
for key0 in districts:
  for key1 in districts[key0]:
    district = districts[key0][key1]
    #print(district)
    try:
        item = {
          'district': district['district_name'] + ', ' + district['province_name'],
          'votes': district['votes'],
          'winner': winner(people,district['votes']),
          'lat': district['lat'],
          'lng': district['lng'],
          'winner_class': slugify(winner(people,district['votes'])),
          'id': int(key0) + int(key1)/10,
          'population': sum(district['votes'])
        }
        items.append(item)
    except:
      nothing = 0
out['votes'] = sorted(items, key=lambda k: k['population'], reverse=True)

print(out)
with open('pa_president_2014.json', 'w') as outfile:
  json.dump(out, outfile)

xml2geocode.py

# -*- coding: utf-8 -*-

# python 3.4

import xml.etree.ElementTree as ET
import urllib
import json
import csv

outfile = open('geocoded2.csv', 'w')
outwriter = csv.writer(outfile, quoting=csv.QUOTE_NONNUMERIC)

tree = ET.parse('provinces.xml')

root = tree.getroot()

provinces = {}
for child in root:
  province_id = child.find('provincia').text
  province_name = child.find('descripcion').text
  provinces[province_id] = {'name': province_name, 'id': province_id}
  #print(province_id,province_name,sep="\t")
#print(provinces)

tree = ET.parse('districts.xml')
root = tree.getroot()

districts = []
for child in root:
  d_id = child.find('distrito').text
  d_prov_id = child.find('provincia').text
  d_name = child.find('descripcion').text
  d_prov_name = provinces[d_prov_id]['name']
  districts.append({'name':d_name,'id':d_id,'province_name':d_prov_name,'province_id':d_prov_id})
#print(districts)

for item in districts:
  print(item)
#  print(item['name'] + ', ' + item['province_name'])
  string = item['name'] + ', ' + item['province_name']
  address = urllib.parse.urlencode({'address':string})
  url = "http://maps.googleapis.com/maps/api/geocode/json?" + address + "&sensor=false&region=pa&language=es"
#  print(url)
  response = urllib.request.urlopen(url)
  data = json.loads(response.read().decode("utf-8"))
  if len(data['results']) > 0:
    print(data['results'][0]['geometry']['location']['lat'],data['results'][0]['geometry']['location']['lng'],data['results'][0]['formatted_address'],sep="\t")
    row = [item['province_id'],item['province_name'],item['id'],item['name'],data['results'][0]['geometry']['location']['lat'],data['results'][0]['geometry']['location']['lng'],data['results'][0]['formatted_address']]
    outwriter.writerow(row)
  else:
    print(data)
outfile.close()