electricitymaps / electricitymaps-contrib

A real-time visualisation of the CO2 emissions of electricity consumption
https://app.electricitymaps.com
GNU Affero General Public License v3.0
3.55k stars 940 forks source link

Add support for 3rd party map geometries #840

Closed systemcatch closed 6 years ago

systemcatch commented 6 years ago

@corradio @brunolajoie @BrianCraig There's issues open at the moment which are blocked due to not having shapes available from the natural earth file we use.

Several of Chile's regions have duplicate hasc and fips codes so cannot be mapped with the functions currently in countrytopos.js. #821. @jarek has also said that there will be similar problems with the Philippines.

The Canary Islands are represented as one feature in natural earth. To split them individually will require either extracting the shapes from natural earth or creating our own geojson for each island. #626

The USA needs to be split into it's component grid regions which are quite intricate and overlapping. We will have to import the geojson from elsewhere or create it ourselves. #143 #787

So as I see it we need to do 2 things. Allow the use of other identifiers from natural earth, and allow the use of other shape/geojson files. However I'm not really a frontend person so discussion on how best to implement this is needed. Realistically the first thing seems much easier to do.

corradio commented 6 years ago

Hi @systemcatch ,

The topogen.sh script contains everything you need to add another identifier. Ping me on Slack if you need help for understanding the script.

The next step would probably be to merge countryTopos.js into topogen.sh, in order to generate the topology files at compile-time rather than runtime.

Sorry for the short answer for now, hopefully we will be able to build something a bit more robust.

Olivier

jarek commented 6 years ago

In some cases (like Canary Islands, Greek islands, or the King Island) the Natural Earth shapefiles do not have required data precision. So we'll need some other sources in addition to topogen transforming Natural Earth, regardless of which ID we use.

systemcatch commented 6 years ago

topogen.sh has now been modified to provide adm1_code and region_cod as usable identifiers. Next step is to create some new functions in countrytopos.js to allow us to get states by them.

corradio commented 6 years ago

I'm renaming this issue to focus on adding support for 3rd party geometries.

corradio commented 6 years ago

Duplicate of #913