Adding a new region
To add a new region
These instructions are how to add a new top-level region to the data. This is something of the same level of import as North America or the UK Mainland
These examples document adding Australia in December 2020
Create the top-level waterway
- sqlite3 data/canal.sqlite
> insert into waterway (id, parent, name, fullname) values('ozoz','','Australia','Waterways of Australia');
check beforehand that the 4 character code doesn't exist. With an exception, for daft historical reasons, the convention is to use something faintly mnemonic,
Give it some boundaries
- sqlite3 data/canal.sqlite
> INSERT INTO "map_boundaries" VALUES('ozoz','{"sw_lng":180,"sw_lat":90,"ne_lng":-180,"ne_lat":-90}');
This will make it the whole of the earth. Once you've added a few places this will be adjusted automatically. You can make things a bit easier by using different values, but ensure you cover the whole of the area.
Stay in sqlite3...
Add a locale
> INSERT INTO "waterway_locale" VALUES('ozoz','km','metric','en','Australia/Canberra');
Create mapping files
- Generate a mbtiles file for the new region and put it into the tileserver (in this case: australia.mbtiles)
- Add an entry to mapping/config/config.hdf - inside the "regions {" block, add:
ozoz {
style = australia-style
openmaptiles = australia
canalplantiles = canalplan_australia
description = Australia
countries = AU
}
notes:
- style should be a sensible name like this
- openmaptiles should be the name of the mbtiles file
- canalplantiles should also be a suitable name
- description - the name of the region (make it the same as the "fullname" in the waterway table in the first stage
- countries is the country code from mapping/worldmap/world.svg. If you need multiple countries (like Europe) then space separate the codes. If you need to break a political entity (as we do for Great Britain to put Northern Ireland with the Republic of Ireland) you can use section codes separated by colons. There is commented out code in can_js/new_selector.js that shows these to the console when you mouseover.
Create mapping data space
- Become www-data - for example by:
sudo -u www-data bash
it is essential that you do that, otherwise you leave a lot of files around that the system needs to write to, but has no permissions.
- Then build the file structure
cd mapping touch geodata/flags/ozoz mkdir geodata/full/ozoz mkdir geodata/waterways/ozoz mkdir geodata/waterways/ozoz/lines mkdir geodata/waterways/ozoz/points
- Then (still in the mapping directory) keep running "make" until it doesn't error and instead generates style files
Add first waterway
- Go to the canalplan home page
- Make sure you are logged in
- Select "Major edit"
- Using "Add isolated place", add the two places at the ends of the first waterway in your region. You may find the map displays oddly because the bounds aren't right yet. You should find the "Zoom to place" feature helps here
- Using "Add waterway" create a waterway between these two places
- Go to Gazetteer
- Select one of these places
- Add an intermediate place on the waterway
After all this it should now generate a waterway, with the appropriate map scaling.
Normal use of the region should now be possible.
