How to upload your own map
In Datawrapper you can upload and use your own custom maps. You might want to visualize data on a map which is highly tailored to your needs, for example to show your regional administrative areas which are not available as a map in our collection. In this article we explain how to create and prepare your map and then upload it in Datawrapper.
Attention: This article is for advanced users.
If you've never worked with geo data such as Shapefiles or GeoJSON before, this article might be a bit tricky. Even if you have relevant experience, preparing maps can take some time. We already offer more than 1000 maps, so make sure that your map does not yet exist in Datawrapper before creating it.
Our map creator Anna is also happy to upload a map for you (if we think that this map would be useful for other Datawrapper users as well.) You can get in touch with her at firstname.lastname@example.org if you would like a specific map to be added to the list.
In order to upload your map in Datawrapper, it needs to...
- be in the TopoJSON or GeoJSON format (we recommend TopoJSON) and be a valid JSON file (check validity with this online tool).
- be smaller than 2MB. The larger your file, the longer it takes for your map to load for those who are viewing your map. We recommend simplifying the map until it's smaller than 500KB.
- have at least one layer with at least one region.
- have regions as polygons (for example administrative boundaries).
- have IDs for these regions.
- use the WGS-84 coordinate system (EPSG:4326 projection).
You also want to make sure that...
- polygons with the same ID are aggregated.
- you set the central points as the interior point (that's only necessary if you want to make use of labels).
We will walk through all the steps together. To do so, you can use an editor capable of working with geo data such as QGIS.
We will use the online tool Mapshaper
. But first, we need some data:
1. Find geo data
If you're reading this article, you might already have some geo data. If not, a simple online search can lead you to a
government site, OpenStreetMap data or an open data portal, which often offer geo data for their country or city. For example:
Geo data comes in many formats like
Shapefiles, GeoJSON or TopoJSON. The latter one is rare on government sites and open data portals, but Shapefiles or GeoJSON will work well for preparing and exporting the map too. So finding geo data is as simple as typing "Shapefile municipalities Mordor" or "GeoJSON regions death star" (or whichever area you're interested in) into your favorite search engine.
If you are confronted with multiple download options, try to find a
"clipped" version of the data: that's the one without the water areas (e.g. a lake or a coast). You might also be able to download data of different sizes (1m, 5m, etc.). Go ahead and
download the smallest one. We will need to reduce the file size of 95% of maps anyway.
2. Load the data into Mapshaper & check your IDs
If you downloaded a Shapefile, you will get a whole folder with four to seven files. Go to mapshaper.org and upload (or drag) all the files from your folder there – or your GeoJSON, if you downloaded that one instead:
With a click on the
i-Button at the right, you can check the IDs behind all your areas. If you don't see any IDs in the info box on the left, your geo data will not work as an upload.
In most cases, you will find more than one ID in the infobox.
Your data should have at least one ID that's unique for all your regions (e.g. a ZIP code for ZIP areas or a census tract code for census tracts). If you have IDs that are the same for the different regions, then you will not be able to assign different data for values for these regions.
A map can have more than one
layer (a layer is a group of regions). Your map must contain at least one such layer. However if there is more than one layer present,
Datawrapper will only display the first one and the others will be ignored, so you may want to delete all the unwanted layers before exporting.
You can view layers in Mapshaper by clicking on the
button centered on the top. In the same dialog you can also delete layers (although the deleted layer might still appear in Mapshaper, it will not be present once you export the map):
3. Bring the data into WGS-84
When you upload your TopoJSON or GeoJSON to Datawrapper,
it needs to be in the WGS-84 coordinate system.
To make sure your map uses WGS-84, open the
console in Mapshaper (either by clicking on "Console" in the top right corner or by pressing your spacebar). Then type "
proj wgs84" in the console and press Enter.
Your map might look a bit different now. To make sure that the projection changed successfully, you can type "
info" into the console. It should give you back lots of information, among others: "
Proj.4: +proj=longlat +datum=WGS8
When converting to WGS-84 in the Mapshaper console, you might get an error which says
"Unable to project -- source coordinate system is unknown
". This means that Mapshaper can not recognise the original coordinate system, and you will need to specify it yourself to convert. For this you will need to check the source of where you downloaded the geo data.
After converting your map to WGS-84,
check your latitudes and longitudes in the bottom left corner of Mapshaper while hovering over your map. If they are way too small (e.g. 0.000383473) or too big (e.g. 3834.73384), Datawrapper won't be able to display the map.
Also watch out for values that are
extremely similar across all regions, for example regions that have latitude values of 13.418139, 13.418150, 13.418152 and so on. These will most likely not get displayed properly when uploaded to Datawrapper.
This WGS-84 "projection" might look a bit weird in Mapshaper, but don't worry: Datawrapper will automatically change the projection once you upload it. Which means that your map will look better (= not as stretched) in Datawrapper than it does in Mapshaper now.
4. Aggregate polygons & set interior points
You're almost done! Before simplifying and exporting your map, these two steps might be necessary for you, but can also be skipped (depending on your needs).
- "Aggregating polygons" is important if you have a country with one ID (e.g. "Denmark"), that's scattered across several regions (e.g. five islands). In this case, you want all the islands to have the same color in a Choropleth map. But if the polygons of the five islands are not connected, Datawrapper will show you five times the same ID for the five islands; instead of just showing you one ID for the five islands. To avoid that, we can "dissolve" the polygons.
To do so, open the console and type " dissolve" followed by the name of the ID that you want to dissolve (e.g "country"): "dissolve country". If you do so, all other IDs will disappear. To avoid that, add a "copy-fields=", for example for your country code ID. The whole console command would look like this: "dissolve country copy-fields=country-code".
- "Setting interior points" is only important if you want to use labels on your map. When you set interior points, your TopoJSON will include the information where that label should be placed. Interior points are very similar to centroid points, but in contrast to centroid points, interior points will be surrounded by as much space as possible in your regions. That's great for labels. To set these interior points, open the console and type "each "cx=$.innerX, cy=$.innerY". That's it!
5. Simplify the data & export
The TopoJSON or GeoJSON that you upload to Datawrapper
needs to be smaller than 2MB. We recommend a size below 500KB. The smaller your map, the faster it will load for your readers. Here's how we decrease the file size in Mapshaper:
Find the button "
Simplify" on the top right. You will get some options. Definitely choose "
prevent shape removal" – you can play around with the rest of the options (or use the defaults). Once you click "Apply", you will get a slider at the top of the window. Drag it to simplify your map.
You will find that your map appearance doesn't really change until you simplify it to around 75%. That's great news for us! It means that our file is smaller, while the appearance is almost the same.
After simplifying, you might have some "
intersections". Click "
So how large is your file after simplifying? You'll only find out when you export the map.
Click on "Export" on the top right and export as TopoJSON.
Note on TopoJSON and GeoJSON files
Depending on the source and type of your original geo data, you may get an exported map which will not be recognised by Datawrapper. Here are the requirements that you can check by looking at your exported file in a text editor:
- A TopoJSON file must have the root "type" property value of "Topology".
- If you are uploading a GeoJSON file, it must have the root "type" property value of "FeatureCollection". This is because the expected input is a collection of regions with named properties. Other values such as "Geometry", "Feature" and "GeometryCollection" will not be accepted.
6. Upload the map to Datawrapper
Now that you have your map, it's time to upload it to Datawrapper.
In Datawrapper, click on "New Map", then choose the map type you want to create. Then select your map file by clicking on the "Upload Map" button. Once uploaded, the map will appear in the preview on the right side.
From here on you can proceed to the next step to fill the map with data, then refine it and finally publish it in the same way as you would with one of our built-in maps. See our tutorials on working with maps.
One more thing. You might be asking yourself: will the uploaded map be automatically added to the public list of Datawrapper maps? The answer is: No. If you upload your own map file, only you will be able to use it. The next time you want to create a map using the same map file, upload the TopoJSON or GeoJSON again.