How to import area & line markers

This article explains how to import area and line markers. 

👉 If you want to add area markers without importing, visit the article "How to add regions as area markers."
👉 If you want to import point markers, visit "How to import point markers."
👉 If you want to style your area and line markers, visit "How to style area and line markers."

To add areas (like settlement boundaries) and lines (like subway lines) to Datawrapper Locator maps, you need to import a GeoJSON. To do so, turn on the switch in step 1: Add markers:

There you have the option to upload a valid GeoJSON. You can also copy and paste a GeoJSON into the text area at the bottom. 

1

Where to get GeoJSONs from

There are multiple ways to get your hands on a GeoJSON file:

2

Prerequisites for your GeoJSONs

In order to import your areas and lines in Datawrapper, your file needs to... 

  • be a GeoJSON and 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 both viewing and editing. Try to keep it as small as possible. If your GeoJSON is too big, go to mapshaper.org, upload your GeoJSON, and try to simplify the geometry. Click the "Simplify" button in the upper right, followed by "Apply." Then drag the slider at the top as far to the right as you can while the geometry still looks good enough. The displayed percentage tells you how much of the data size is left. Typically you can go down to 10-15% without noticing a big difference. When you're done, click "Export," select GeoJSON, and re-upload the data to Datawrapper.
  • use the WGS-84 coordinate system (EPSG:4326 projection).
  • include coordinates.
  • have fewer than 20 differently styled features. Scroll to "How to import your GeoJSON to Datawrapper" to learn more.

It's ok if your GeoJSON includes additional information and properties, like this one that shows the metro lines in Shanghai as of 2016:

3

How to import your GeoJSON to Datawrapper

Once you have a GeoJSON ready, copy and paste it into the text area or click on "Import GeoJSON or CSV":

You will see that Datawrapper shows all lines with the same stying properties (like "color") as one marker. In our GeoJSON, no lines but two have a color defined. These two subway lines have the property "color":"red". That's why they're shown as a single marker and appear red on the map. If you want to style the individual subway lines, you need to give them properties before importing them to Datawrapper.

👉 You can also add properties to the GeoJSON, to style the areas and lines before importing them to Datawrapper. For more information and a list of supported property names, visit the article: "How to style your markers before importing them to Datawrapper."

If you upload GeoJSONs that are very big or that have many different markers, your map will be slower for both you (in the editing process) and for your readers (when they view the website where you embedded the map). Consider styling lines and areas in the same way, so that they get imported to Datawrapper as one marker. 

4

How to change the order of areas and lines

Maybe two or more areas overlap on your map, and you're not happy with their order. To change that, you can grab and drag your markers around in the marker list:

Please note: If your map shows not just areas and lines, but also points, then they will always be on top. It's not possible to get point markers to appear below line or area markers.