aourednik / historical-basemaps

Collection of georeferenced boundaries of world countries and cultural regions for use in mapping historical data on global or continental scale
GNU General Public License v3.0
441 stars 75 forks source link

make sure that bordering countries don't have the same color #6

Closed lennertVanSever closed 3 years ago

lennertVanSever commented 3 years ago

First of all, thanks for publishing these maps, it helped me a lot with a side-project that I'm working on :) I had an issue that in my side-project, countries bordering each other could have the same color which is confusing. I fixed this by calculating the bordering country of every country. For example, now the dutch east indies have two bordering countries, Papua New Guinea and Malaya. Based on this data, I released a graph coloring algorithm on the countries and calculated the BORDER_COLOR_INDEX. This index can then be used to assign a color to a country.

{
  "type": "Feature",
  "properties": {
    "AREA": 655357.689,
    "NAME": "Dutch East Indies",
    ...
    "BORDERING": [
      "Papua New Guinea",
      "Malaya"
    ],
    "BORDER_COLOR_INDEX": 1
  }
  ....
}

Apologies for not maintaining the same JSON indentation, I couldn't find an easy way to keep it the same. I was also not able to generate the other png files.