mgastner / cartogram-cpp

Cartogram generator in C++
MIT License
8 stars 4 forks source link

Allow subsetting by excluding regions from CSV #196

Open adisidev opened 1 month ago

adisidev commented 1 month ago

Currently, when the GeoJSON has region X but the CSV doesn’t, we presume the user means there is no data available for the region (and mark the region as such). However, I believe if this is the case, users should mention the region in the CSV with value NA.

Thus, I propose we change our current convention: When region X is in the GeoJSON, but not in CSV: the CSV acts as a “subsetting” operation, i.e. we remove the region in the output maps. This would be helpful for users to make political decisions themself, allowing us to retain a neutral stance (that is, users can choose to exclude a politically contentious region from their output map).

When region X is not in the GeoJSON, but in the CSV: ring the alarm bells (error). We should make the user aware that a region they're trying to plot does not exist. An easy fix would be for them to remove the line from the CSV. Otherwise, if they intend for the region to be plotted, they should look for a different GeoJSON file.

adisidev commented 1 month ago

We can change the WARNING message to something like this:

    std::cerr << "These regions will be removed from the map output." << std::endl;
    std::cerr << "If there is no data for these regions, but you still want "
                 "them in the cartogram, please add them to the CSV with the "
                 "value 'NA' (without quotes)."
              << std::endl;