Skip to content

Commit

Permalink
improve documentation for country maps (apache#10621)
Browse files Browse the repository at this point in the history
  • Loading branch information
czue authored and villebro committed Sep 16, 2020
1 parent 7d44680 commit 1f87e3a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions docs/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.

0 comments on commit 1f87e3a

Please sign in to comment.