-
Notifications
You must be signed in to change notification settings - Fork 951
Edit world geometries
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.
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.
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.
-
Import world.geojson in QGIS. Ideally select XYZ tiles > OpenStreetMap and then drag the file into the view.
-
Toggle editing on the file. Right click the layer and select "Toggle editing"
-
Enable 'Topological Editing' under Project > Snapping Options > 'Enable Topological Editing' (see note below on why)
-
Select Vertex Tool. You can now drag around the vertices of the polygons to modify the polygon.
-
When you are done editing, select "Toggle editing" again and save the new file.
-
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.
- Import world.geojson in QGIS. Ideally select XYZ tiles > OpenStreetMap and then drag the file into the view.
- Toggle editing on the file. Right click the layer and select "Toggle editing"
- Select the "Add Polygon Feature" tool. You can now draw a new polygon. Close the polygon by right-clicking.
- 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".
- When you are done editing, select "Toggle editing" again and save the new file.
- You can now run
pnpm generate-world
.
- Import world.geojson in QGIS. Ideally select XYZ tiles > OpenStreetMap and then drag the file into the view.
- Toggle editing on the file. Right click the layer and select "Toggle editing"
- Select the "Select Feature By Area or Single Click" tool. You can now select a polygon.
- When a polygon has been selected, you can hit the delete button to remove the polygon.
- When you are done editing, select "Toggle editing" again and save the new file.
- 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.
You can create bounding boxes for new or existing zones in config/zones
:
- If replacing existing bounding boxes, first update value in
config/zones/ZONE.yaml
with"bounding_box": null
- Run:
ts-node --esm generateZoneBoundingBoxes.ts ZONE
Do you have a question or an idea for improvements? Open a new discussion here