Skip to content

Edit world geometries

Mads Nedergaard edited this page Jul 12, 2023 · 10 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. Enable 'Topological Editing' under Project > Snapping Options > 'Enable Topological Editing' (see note below on why)

  4. Select Vertex Tool. You can now drag around the vertices of the polygons to modify the polygon. Screenshot 2023-07-12 at 13 44 32

  5. When you are done editing, select "Toggle editing" again and save the new file.

  6. You can now run pnpm generate-world inside the /web folder.

Note: There is a setting in QGIS called 'Topological Editing' which, when enabled, allows QGIS to determine shared boundaries between different features (polygons in our case) and automatically update the geometries of all relevant features when a vertex shared by multiple features is moved. Without this setting, you need to manually modify the neighbouring 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 pnpm generate-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 pnpm generate-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:

  1. If replacing existing bounding boxes, first update value in config/zones/ZONE.yaml with "bounding_box": null
  2. Run: ts-node --esm generateZoneBoundingBoxes.ts ZONE
Clone this wiki locally