From f8db1890930e12db21c7091605bcdab3cd43825a Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Mon, 17 Aug 2020 15:16:35 +0200 Subject: [PATCH] improve documentation for country maps --- docs/visualization.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/visualization.rst b/docs/visualization.rst index b56a97998b841..b8d53a9b33c70 100644 --- a/docs/visualization.rst +++ b/docs/visualization.rst @@ -1959,7 +1959,9 @@ List of Countries Need to add a new Country? ------------------------------- -To add a new country in country map tools, we need to follow the following steps : +Warning: adding a new country is not easy and requires building superset from source! + +To add a new country in country map tools, you need to follow the following steps : 1. You need shapefiles which contain data of your map. You can get this file on this site: https://www.diva-gis.org/gdata @@ -1970,13 +1972,17 @@ To add a new country in country map tools, we need to follow the following steps 3. You need to convert shapefile to geojson file. This action can make with ogr2ogr tools: https://www.gdal.org/ogr2ogr.html -4. Put your geojson file in next folder : superset-frontend/src/visualizations/CountryMap/countries with the next name : nameofyourcountries.geojson +4. You can to reduce size of geojson file on this site: https://mapshaper.org/ + +5. You will need to put your geojson file in the right place in the @superset-ui npm package. This is the "countries" folder in + ./superset-frontend/node_modules/@superset-ui/legacy-plugin-chart-country-map/esm/. + The .geojson files for other countries are already in this folder. -5. You can to reduce size of geojson file on this site: https://mapshaper.org/ +6. You will also need to edit the "countries.js" file in the same directory, following the pattern of the other countries. -6. Go in file superset-frontend/src/explore/controls.jsx +7. Then go to the file superset-frontend/src/explore/controls.jsx -7. Add your country in component 'select_country' +8. Add your country in component 'select_country' Example : .. code-block:: javascript @@ -2005,3 +2011,6 @@ To add a new country in country map tools, we need to follow the following steps ].map(s => [s, s]), description: 'The name of country that Superset should display', }, + + +9. Rebuild the front end from source and restart superset.