We're suggesting our client in Pakistan to organize their data as:
Province
District
Area
Region Type
Sindh
Sindh
133702
Province
Punjab
Punjab
208306
Province
Sindh
Karachi
3527
District
Punjab
Lahore
1772
District
...
...
...
...
Now, if I'm plotting the district's area in a map, I will end up getting the
province's area as well. As provinces are generally much bigger than districts,
the scales will be screwed (i.e. all districts will fall in the lowest levels,
and there's nothing on the others. The map will have a single color).
If that's the data structure we want to allow, we'll have to allow filtering as
well. But there's a caveat: enabling filters the same way we use in
ckanext-basiccharts, for example, will create terrible maps.
For example, say that you're viewing a dashboard with a barchart and a
choropleth map. Then you click on a region in the choropleth map, which will
add a filter for that region. The barchart changes to show only that and, if we
enable filters in the maps, they'll change too. So we'll see a choropleth map
with a single colored region. Worse, the "adding filters by clicking on
regions" feature only works for regions we have data for. If we're filtering,
we'll start limiting the user's choices.
Maybe (probably?) the solution isn't to add filters, but to not consider
regions that aren't in the map when creating the scales.
This was easier than I thought at first. The solution is to simply remove any rows that are in the data but aren't going to be plotted on the map (because we don't have a region for it).
We're suggesting our client in Pakistan to organize their data as:
Now, if I'm plotting the district's area in a map, I will end up getting the province's area as well. As provinces are generally much bigger than districts, the scales will be screwed (i.e. all districts will fall in the lowest levels, and there's nothing on the others. The map will have a single color).
If that's the data structure we want to allow, we'll have to allow filtering as well. But there's a caveat: enabling filters the same way we use in
ckanext-basiccharts
, for example, will create terrible maps.For example, say that you're viewing a dashboard with a barchart and a choropleth map. Then you click on a region in the choropleth map, which will add a filter for that region. The barchart changes to show only that and, if we enable filters in the maps, they'll change too. So we'll see a choropleth map with a single colored region. Worse, the "adding filters by clicking on regions" feature only works for regions we have data for. If we're filtering, we'll start limiting the user's choices.
Maybe (probably?) the solution isn't to add filters, but to not consider regions that aren't in the map when creating the scales.