Skip to content

Edit world geometries

Mads Nedergaard edited this page Apr 4, 2022 · 11 revisions

How are the geometries set up?

All geometries are stored in the world.geojson. Each feature of the geojson file contains a property "zoneName" to map it the correct zone. The geometries shown on the map is an automatically generated topojson file based on the geojson file.

All edits to geometries should be done directly to the world.geojson file.

Publish new changes

To publish a new version of the world.geojson file, run yarn && yarn update-world (in the web folder) which will validate and generate a new topojson file to be shown on the map.

Geojson edit tutorials

The following sections contain examples of how to perform the most common edits to the world.geojson file. In these examples, the free tool QGIS is used.

Modifying an existing zone

  1. Import world.geojson in QGIS. Ideally select XYZ tiles > OpenStreetMap and then drag the file into the view.
  2. Toggle editing on the file. Right click the layer and select "Toggle editing"
  3. Select Vertex Tool. You can now drag around the vertices of the polygons to modify the polygon.
  4. When you are done editing, select "Toggle editing" again and save the new file.
  5. You can now run yarn update-world.

Note that the validation script does not allow overlaps or gaps. This means that when modifying borders, make sure to also modify the neighboring polygons to ensure that there are no overlaps or gaps between them.

This video also shows the basics of the vertex tool.

Add a new geometry

  1. Import world.geojson in QGIS. Ideally select XYZ tiles > OpenStreetMap and then drag the file into the view.
  2. Toggle editing on the file. Right click the layer and select "Toggle editing"
  3. Select the "Add Polygon Feature" tool. You can now draw a new polygon. Close the polygon by right-clicking.
  4. A dialogue box appears asking you to input "zoneName", "countryKey", "countryName". Fill in the correct information. For example for France, the input would be "FR", "FR", "France".
  5. When you are done editing, select "Toggle editing" again and save the new file.
  6. You can now run yarn update-world.

Remove a geometry

  1. Import world.geojson in QGIS. Ideally select XYZ tiles > OpenStreetMap and then drag the file into the view.
  2. Toggle editing on the file. Right click the layer and select "Toggle editing"
  3. Select the "Select Feature By Area or Single Click" tool. You can now select a polygon.
  4. When a polygon has been selected, you can hit the delete button to remove the polygon.
  5. When you are done editing, select "Toggle editing" again and save the new file.
  6. You can now run yarn update-world.

Most edits can be done by a combination of the above sections. If you are stuck on an editing problem, please create a new discussion and provide screenshots of what you want to achieve.

Generate bounding boxes for a zone (if missing in zones.json)

You can create bounding boxes for new or existing zones in config/zones.json:

  1. Update the zone you want to update in config/zones.json with "bounding_box": null
  2. Run: node geo/generate-zone-bounding-boxes.js
Clone this wiki locally