feat: add France's regions to country map visualization#25676
feat: add France's regions to country map visualization#25676rusackas merged 2 commits intoapache:masterfrom dmeaux:master
Conversation
villebro
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding the regional granularity!
|
@dmeaux Does it work on your system ? The file france_regions.geojson appear to be huge compared to the other ones (12 MB). It does not display correctly
But it can confirm it displays correctly with matplotlib, using the Country Map GEOJSON Generator notebook. What could be the problem ? |
|
Yes, It does. The geometries are much more detailed than the other layers.
David
***************************************************************
DAVID MEAUX
…________________________________
From: Quentin Leroy ***@***.***>
Sent: Monday, January 29, 2024 10:03
To: apache/superset ***@***.***>
Cc: David Meaux ***@***.***>; Mention ***@***.***>
Subject: Re: [apache/superset] feat: add France's regions to country map visualization (PR #25676)
@dmeaux<https://github.com/dmeaux> Does it work on your system ?
The file france_regions.geojson appear to be huge compared to the other ones (12 MB).
It does not display correctly
france.regions.broken.png (view on web)<https://github.com/apache/superset/assets/9881262/8158b978-9e10-4cc1-a46f-a548a3a9d50b>
But it can confirm it displays correctly with matplotlib, using the Country Map GEOJSON Generator notebook.
What could be the problem ?
—
Reply to this email directly, view it on GitHub<#25676 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALUBDUEXWTXWI37RRA3DGSTYQ5QVRAVCNFSM6AAAAAA6DR4HRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJUGI2DQNJSGI>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
@qleroy Check out this line at the top of the file: I will reproject the data to WGS 84 and simplify the geometries to decrease the file size and then recommit the file. This should fix the issues you're seeing. |
|
thank you @dmeaux maybe d3 does not take the coordinates system into account I don't know. I was considering including also DOM/TOM with cartiflette |
|
I double checked, According to d3 docs and referring to the plugin CountryMap.js, all *.geojson files are expected to be projected with the default projection. All geojson files are in the urn:ogc:def:crs:OGC:1.3:CRS84 projection except for france_regions.geojson ! So that is why it cannot by displayed properly in Superset with the plugin code as is. for f in $(ls superset/superset-frontend/plugins/legacy-chart-country-map/src/countries)
do
echo $f
jq '.crs' $f
doneimport geopandas as gpd
df = gpd.read_file('superset-frontend/plugins/legacy-chart-country-map/src/countries/france_regions.geojson')
print(df.bounds)
france_regionsgeojson
minx miny maxx maxy
0 428145.7 6137101.2 848021.3 6439668.0
1 476864.7 6584220.1 709599.9 6872271.0
2 342953.8 6788980.8 612865.2 6998209.9
3 311617.1 6193024.1 669901.0 6679340.2
4 728354.5 6710828.6 1082838.3 7009414.0
5 799585.9 6214487.5 1077719.3 6453457.6
6 626126.3 6338318.9 1027292.6 6633794.6
7 688333.0 6562601.2 1011638.9 6811153.5
8 276123.7 6582709.1 545050.0 6834664.4
9 583916.5 6859783.5 790288.4 7110478.8
10 99040.0 6704161.1 400665.5 6886001.0
11 1156227.0 6046546.3 1242440.3 6235448.1
12 586421.7 6780020.5 741205.6 6905411.1 |
|
I've created a pull request with the updated geojson file. Until it gets merged you can use the new GeoJSON file. |





SUMMARY
France's Regions have been added as a selection to the Country Map visualization. The geometries were taken from IGN's (France's National Geographic Institute) BD TOPO (R) administrative layer, and the ISO 3166-02 codes for the regions were added as an attribute.
BEFORE/AFTER SCREENSHOTS
France's Departments:

France's Regions:

TESTING INSTRUCTIONS
ADDITIONAL INFORMATION