improve documentation for country maps (#10621)

This commit is contained in:
Cory Zue 2020-08-18 18:36:35 +02:00 committed by GitHub
parent 0d3caf08e5
commit 4ee524736d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 5 deletions

View File

@ -1959,7 +1959,9 @@ List of Countries
Need to add a new Country? 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. 1. You need shapefiles which contain data of your map.
You can get this file on this site: https://www.diva-gis.org/gdata 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. 3. You need to convert shapefile to geojson file.
This action can make with ogr2ogr tools: https://www.gdal.org/ogr2ogr.html 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 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.
6. Go in file superset-frontend/src/explore/controls.jsx 6. You will also need to edit the "countries.js" file in the same directory, following the pattern of the other countries.
7. Add your country in component 'select_country' 7. Then go to the file superset-frontend/src/explore/controls.jsx
8. Add your country in component 'select_country'
Example : Example :
.. code-block:: javascript .. 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]), ].map(s => [s, s]),
description: 'The name of country that Superset should display', description: 'The name of country that Superset should display',
}, },
9. Rebuild the front end from source and restart superset.