Atlas PRFree, open, interactive, detailed maps of Puerto Rico for your web applications.

Pueblos - PoblaciĆ³n en el 2012

 1 // change the argument to match your id
 2 var node = document.getElementById("poblacion-map");
 3 d3.json("../data/munidata.json", function(data){
 4   var pop_datamap = {};
 5   //use FIPS code as key
 6   data.forEach(function(pueblo){
 7     //get id of pueblo with leading 0s.
 8     var fips_3digits = pueblo.fips.length == 1 ? ("00" + pueblo.fips) : 
 9       (pueblo.fips.length == 2 ? ("0" + pueblo.fips) : pueblo.fips);
10     pop_datamap[fips_3digits] = pueblo.population;
11   });
12   var pop_map = new AtlasPR({node: node, size: "large", tiles: 'pueblos', on_ready: function(){
13     // paint after drawing async.
14     pop_map.encode_quan(pop_datamap);
15   }});
16 });
Fork me on GitHub