The code already has something similar to our desired outcome of rescaling area < total_inset_area * epsilon to total_inset_area * epsilon under the replace_missing_and_zero_target_areas() function under cartogram_info.cpp. I believe the bug with Singapore occurs because the code calls small_area_threshold_frac as epsilon. I believe this defaults to ~0.00001 (0.001% of target inset areas), which results in negligibly small rescalings. I've amended this to be 0.001 (0.1%) of total_inset_area, allowing and cartogram to return something which looks more reasonable.
I've left the geojson and csv of Singapore in the sandbox for review.
The code already has something similar to our desired outcome of rescaling
area < total_inset_area * epsilon
tototal_inset_area * epsilon
under thereplace_missing_and_zero_target_areas()
function undercartogram_info.cpp
. I believe the bug with Singapore occurs because the code callssmall_area_threshold_frac
asepsilon
. I believe this defaults to ~0.00001 (0.001% of target inset areas), which results in negligibly small rescalings. I've amended this to be 0.001 (0.1%) oftotal_inset_area
, allowing andcartogram
to return something which looks more reasonable.I've left the geojson and csv of Singapore in the sandbox for review.