{ "settings" : { "map type": "globe", "query limit": 72, "start": { "lon": 31.233333, "lat": 30.05, "height": 1.0 }, "info url": "http://mousebird.github.io/WhirlyVizConfig/une/uneinfo.html" }, "background": [ { "type": "color", "color": "#82CAFAFF", "_comment": "light sky blue" }, { "type": "tilejson", "url": "http://a.tiles.mapbox.com/v3/mousebird.map-2ebn78d1.json", "maxzoom": 5 } ], "styles": [ { "name": "outline_style", "type": "vector", "color": "#FFFFFFFF", "width": 3.0, "fade": 0.5 }, { "name": "loft_style", "type": "loftpoly", "color ramp": [ "#33CCFF66", "#3399FF66", "#3366CC88", "#3333CC66", "#6633CC88", "#9933FF88", "#FF007F88", "#FF00FF88"], "fade": 0.5 }, { "name": "outline_label", "type": "label", "textColor": "#FFFFFFFF", "shadowColor": "#000000FF", "shadowSize": 1.0, "textHeight": 18.0, "fade": 0.5 } ], "controls": [ { "name": "data_set", "display name": "Data Set", "type": "list", "default" : "28", "initial index" : 12, "value query": { "type" : "json_list", "query" : "data_set_list" } } ], "queries": [ { "name": "main_query", "display name": "Stats By Country", "styles": ["outline_style","loft_style"], "query": "http://mousebird.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT ne_110m_admin_0_map_units.the_geom,(0.1*(une_measurements.measurement-({{data_set_min}}))/({{data_set_max}}-({{data_set_min}}))+0.01) as height, une_measurements.measurement as measurement,((une_measurements.measurement-({{data_set_min}}))/({{data_set_max}}-({{data_set_min}}))) as color_ramp, ne_110m_admin_0_map_units.name FROM ne_110m_admin_0_map_units inner join une_nations on ne_110m_admin_0_map_units.adm0_a3 = une_nations.iso3 inner join une_measurements on une_nations.id = une_measurements.nation_id WHERE ST_Intersects(ne_110m_admin_0_map_units.the_geom,ST_SetSRID(ST_Point({{taplon}},{{taplat}}),4326)) AND une_measurements.data_set_id = {{data_set}}" }, { "name": "max_query", "query": "http://mousebird.cartodb.com/api/v2/sql?q=SELECT MAX(measurement) FROM une_measurements where data_set_id = {{data_set}}" }, { "name": "min_query", "query": "http://mousebird.cartodb.com/api/v2/sql?q=SELECT MIN(measurement) FROM une_measurements where data_set_id = {{data_set}}" }, { "name": "data_set_list", "query" : "http://mousebird.cartodb.com/api/v2/sql?q=SELECT id as list_value,variable_name as display_name FROM une_data_sets WHERE display = true ORDER BY id" }, { "name": "data_set_units_query", "query" : "http://mousebird.cartodb.com/api/v2/sql?q=SELECT units from une_data_sets WHERE id = {{data_set}}" } ], "events": [ { "type": "onTap", "actions": [ { "type" : "clear popups"}, { "type" : "geo query", "query" : "main_query"} ] }, { "type": "onSelect", "actions": [ { "type" : "clear popups"}, { "type" : "add popup", "text" : "{{name}}
{{measurement}} {{data_set_units}}"} ] }, { "type": "onConfig", "actions": [ { "type" : "clear popups"}, { "type" : "var query", "query": "max_query", "var": "data_set_max"}, { "type": "var query", "query": "min_query", "var": "data_set_min"}, { "type": "var query", "query": "data_set_units_query", "var": "data_set_units"}, { "type": "query clear"}, { "type": "display", "text": "{{data_set}}"} ] }, { "type": "onStartup", "actions": [ { "type" : "var query", "query": "max_query", "var": "data_set_max"}, { "type": "var query", "query": "min_query", "var": "data_set_min"}, { "type": "var query", "query": "data_set_units_query", "var": "data_set_units"}, { "type": "display", "text": "Crude Birth Rate"} ] } ] }