def yesno_layers(layer_title, data): """Return a list of KML layers which make sense for boolean data stored as "yes" or "no" strings.""" low_res = geo.aggregate_grid(UGANDA_RECT, 20, 20, data) hi_res = geo.aggregate_grid(UGANDA_RECT, 120, 120, data) return [ overlay.placemark_layer(low_res, boolean_data.placemark_from_aggregate, layer_title), overlay.polygon_layer(low_res, boolean_data.polygon_from_aggregate, layer_title + ' low-res'), overlay.polygon_layer(hi_res, boolean_data.polygon_from_aggregate, layer_title + ' hi-res'), overlay.heatmap_layer(UGANDA_RECT, 20, 20, low_res, layer_title, 'low-res'), overlay.heatmap_layer(UGANDA_RECT, 120, 120, hi_res, layer_title, 'hi-res'), ]
def numeric_layer(layer_title, data): """Return a KML layer summarizing numeric survey data.""" data = geo.aggregate_grid(UGANDA_RECT, 20, 20, data) return overlay.placemark_layer(data, numeric_data.placemark_from_aggregate, layer_title)