Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve documentation for country maps #10621

Merged
merged 1 commit into from
Aug 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.