OpenStreetMap logo OpenStreetMap

SomeoneElse's Diary

Recent diary entries

Screenshot of the svwd05 map style, showing a Walkers Shortbread shop in Scotland

I created this for my own use, but am sharing it here because it might be useful to other people too. This is the style and there’s a brief readme.

It uses different colours to highlight different map layers. It’s not supposed to look nice; just to show you what is there.

I believe that everything described in the schema is included. If a feature does not appear it might be because:

  • it’s not in the Shortbread schema.
  • it’s in the schema, but is for some reason missing from the OSMF vector tiles.
  • it’s in the tiles, but there’s a bug in this style.

There are lots of features in the first category, and there seem to be a couple in the second. If anyone finds anything in the third category please let me know!

Location: Inverallan, Grantown-on-Spey, Highland, Scotland, PH26 3NS, United Kingdom

Recently, there’s been quite a lot of discussion about the problems with using the tag “highway=path” in the forum. See for example threads here, here, here, here, here, here, here, here, here, here, here, here, here, here, here, here, here, here, here, here and here - and that’s only the last month or so!

It’s not descriptive

On it’s own, “highway=path” doesn’t really say anything other than it’s somehow possible to get from one end to the other. Have a look at the pictures in the wiki - all of those are regularly tagged as “highway=path” in some regions.

There are some really bizarre examples out there. Up the Hillary Step to get to the top of Everest? highway=path. A scuba diving route? highway=path.

While it is possible to add extra tags to say a bit more about the feature being mapped, often this simply isn’t done.

A data consumer (map maker, routing app creator or even just a human deciding whether to go for a walk somewhere) can’t tell what they’re going to find.

The idea is that you can tag a path for pedestrians as “highway=path; foot=designated” and one for cyclists as “highway=path; bicycle=designated”.

The problem here is that “foot” and “bicycle” are “access” tags, and these aren’t always “yes” or “no”. Valid values might be “customers”, “destination”, “permissive” amongst others. If the “foot=designated” on a “highway=path” implies “foot=yes”, what should the tagging be if only customers are allowed?

In countries with some form of allemansrätten (much of Scandinavia, some other places in Europe, including Scotland) this is less of an issue. If you know you can go pretty much anywhere you don’t need to explicitly tag “foot=yes” on everything, and tagging “highway=path; foot=designated” isn’t a problem.

In England and Wales it absolutely is a problem. We do have the “designation” tag for public footpaths A public footpath sign and other rights of way, but we also have other examples of allowed access including CRoW Act Access Land, rules for the New Forest, and (for an area of land not far from me), “Strensall Camp Military Lands byelaws 1936”, “Strensall Common byelaws 1972”, “Strensall Common (use for military purposes) regulations 1971” (and previously the revoked “Strensall Common and land adjoining or near it byelaws 1936”, “Strensall Common and land adjoining or near it byelaws 1927”, “Strensall Common Rifle and Revolver Practice general regulations 1938”, “Strensall Common Rifle and Revolver Practice general regulations 1933” and “Strensall Common Rifle and Revolver Practice general regulations 1926”). There’s an actual copy of “Statuary Instruments 1972 no 246, The Strensall Common Bylaws 1972” at the entrance that you can read before letting Colin off the leash. It’s complicated, and being able to tag foot=yes makes things much simpler.

So what to do?

In England and Wales, if at all possible, try and use some other “highway” tag in place of “highway=path”. That might be “highway=footway” or it might be something else, depending on what it is most like. If literally nothing else fits, it might still be “highway=path”, but please do try and add more tags to describe the thing as much as possible.

Wherever you are, you can try and identify potential problems and add more tags to mitigate them. I created a QA page for myself. Those are just overpass queries and can be moved anywhere you like and saved as bookmarks.

Happy mapping! walking boots

Location: Piethorn, Helmsley, North Yorkshire, York and North Yorkshire, England, YO62 5HL, United Kingdom

An sve01 / svwd01 vector map

For some time I’ve been looking after a raster map style that’s designed to be a useful “England and Wales rural pedestrian” map, and also to showcase some of the richness of data that might not be obvious from basic “general” map styles such as the ones on OpenStreetMap.Org.

A goal for some time has been an offline version of that map style. At any useful level of detail that requires different technologies to be used, and the first parts of that - a vector map schema and a web map style - are now available (though not yet available offline).

The online version of that map is available here. It’ll take a couple of seconds to appear.

How vector maps work

Essentially, something takes OSM data (such as a “.pbf” file) and creates “vector map tiles” from it, often as a large “.mbtiles” file. This file is essentially a small database containing information about what features are present at what zoom levels (but not what they should look like). The client (in this case a web browser running some JavaScript) reads a file that contains details about the desired display style and uses that to present map features to the user.

The software used to create the vector map tiles was Tilemaker. The Javascript libraries used by the web browser are from MapLibre and the map style was created using the MapLibre Style Spec.

Vector map schemas

Various vector map schemas exist for use with OpenStreetMap data. OpenMapTiles is one; Shortbread is another.

I looked at both of these, but neither contained all the data that I knew that I wanted. However, my existing raster maps already consolidate OSM data into a format designed for display, so the obvious approach was to define a schema based on that.

Both osm2pgsql and Tilemaker use lua for scripting, which means that much of the required code is already written needing only cosmetic modifications. Some code is already shared between the two projects; eventually most or all of the “schema” code will be.

Simplifying the schema

The raster display map style dates from what was in OSM Carto in about 2014, before it was changed to be less useful as a pedestrian map.

There are about 76 layers in there, which is significantly more than required. I reduced this to 9. Of those, “water” just contains merged-in coastline data and “poi” isn’t extracted by default (it’s a catch-all designed to spot another that hasn’t been picked up in “land1” and “land2”). The readme has more information.

The new vector map style

The styling options available with MapLibre are broadly similar to CartoCSS but with more control of how things change from one zoom level to another.

I’ve tried to make the new style more consistent both about how each layer is defined in the code, and also about how it appears. For example, all text uses the same font; with different colours used to show different classes of features and text size used to show differences in a class.

The fonts used are from Klokantech, in turn based on Google’s noto.

Road shields had to be reimplemented from scratch, resulting in proper UK/IE versions as opposed to the nondescript-looking raster ones.

When reimplementing the new style I found a number of feature combinations which had simply never been handled by the raster display code, such as derelict canal bridges, so the new vector display style actually handles more data combinations than the old raster one.

Some raster features haven’t been implemented fully or at all yet - notably “way area” controls on zoom level of things such as island names.

A debug vector map style

In order to see what’s present in the vector map tiles a debug style has also been created, although that is not yet deployed anywhere.

Speed and size

The vector tiles and the style to interpret them are quite large, so loading an initial page does take a few seconds. This is less of an issue than it might be as the eventual goal of this project is offline maps; if map tiles are already on a device the time to load is obviously less.

Creating a vector map of Britain and Ireland takes 12 minutes on a server where a database reload of the equivalent for raster maps takes 90. Each resulting “.mbtiles” file is about 4GB; each equivalent database for raster tiles about 40GB, plus about 10GB of metatile cache.

More information

See github projects SomeoneElse-vector-extract and SomeoneElse-vector-web-display, and readme files for the schema scripts, the schema itself, the style management scripts and the style itself.

Location: Erringden, Calderdale, West Yorkshire, England, United Kingdom

Unsuitable for motor vehicles mopeds and cyclists

My previous diary entry looked at the UK section of this OSM wiki page. A commenter there noticed that neither the wiki table nor my analysis covered highway=track (covered here) or highway=service (left for later).

We’ll use the same approach as before. Essentially, that’s this urban area (and this when looking at designation), and this rural area.

It’s useful to look at designation because that tells us what some of the access values should be, and also local authority data about public rights of way such such as visible in this overlay. We’ll therefore ignore ways in OSM with designation set but look to see if any of our examples “should” be designated as a public right of way.

Another thing to consider is things where legal access rights are “unusual”. For example, I suspect that this is legally some sort of road. According to this it’s not a public right of way such as a “byway open to all traffic”; I suspect that it’s actually legally a road, even though the signage is at best confusing. In this example, see also this changeset in OSM. Other examples of “this is probably legally a road” are indicated by “unsuitable for motors” signs - although in most vehicles you probably wouldn’t want to ignore that advice!

Some of these legal oddities are sometimes referred to as “Unclassified County Roads (UCRs)” (or similar). See here (pdf) for a document from Devon. As to what vehicular access rights there are, that guidance is about as solid as the muddy surface of some of the examples.

Some things that are public rights of way might not be explicit about what sort of right of way - these may be signed on the ground as just “public right or way”; OS maps sometimes show them as “Other Routes with Public Access (ORPAs)”. For (much!) more info, see a blog post here.

Another thing we can use to infer access is if e.g. a long distance cycle route runs along somewhere. Sustrans have negotiated permssive access for both foot and bicycle traffic to a number of places like this.

Land managed by Forestry England often allows permissive foot, bicycle and horse access along roads and tracks, signed at each entrance. I can’t comment on what the equivalent Welsh situation is.

track, urban

There’s nothing in the wiki table for track so we’ll need to provide answers for all transport modes.

https://overpass-turbo.eu/s/1Pa4

https://overpass-turbo.eu/s/1Pa6

https://map.atownsend.org.uk/maps/map/map.html#13/53.9616/-1.0920/O/P

Looking at those, the vast majority are actually private. Some are genuinely unknown (even following survey), a couple are permissive, and a couple (such as here are actually foot=yes rather than the foot=permissive that is actually signed on the ground. However, in this urban area, “most tracks are private” is broadly true.

track, rural

https://overpass-turbo.eu/s/1Pa8

https://overpass-turbo.eu/s/1Pa9

https://map.atownsend.org.uk/maps/map/map.html#13/54.2766/-0.8819/H/P

One thing to note is that there are a lot of these. I’ve cross-referenced a few examples only here. Another is that the match between what the local authority think are PRoWs and what actually exists on the ground is not 100%. Where I’ve been involved in mapping areas myself (e.g. here) I’ve tried to reconcile “which path must match which PRoW”.

With regard to motor vehicle access (of any sort), the only rural examples that are are possibly =yes or =permissive are the “these are actually probably roads” examples mentioned above such as here (mentioned earlier) and also Spaunton Lane here. One caveat though is that according to the LA there appear to be very few “byways open to all traffic” at all in this area, so the unmapped number of those is also low. This will vary elsewhere of course.

Summarising that for here, the vast majority of tracks without explicit access signage in this area do genuinely appear to be private with regards to motor traffic.

With regard to foot traffic for the same list I think that it’s safe to assume that the “actually probably roads” ones are at least foot=permissive, and probably =yes. Quite a lot of this area is Access Land via the CRoW Act; foot access there will be yes (anywhere across the land, not just on tracks). Elsewhere, from experience I can say that foot access to some farm tracks will be tolerated if it’s low-volume and local; but there are other examples where even legal access via PRoWs is discouraged (and sometimes illegally prevented).

To summarise the above for foot traffic, if you can’t figure out what the access rights should be you should probably assume private. The big caveat here is that “figuring out what the access rights should be” might be difficult in less well-mapped areas, as it involves knowing about any missing public footpaths and bridleways, access land, Forestry England land, Sustrans cycleways and UCRs

Moving on to horse and bicycle, the argument is much the same as foot, but with fewer designations implying horse or bicycle access. A curiosity is this sign on this track saying “Unsuitable for motor vehicles mopeds and cyclists”. Based on the other on the ground signage I suspect there is legal cycle access here, despite the sign.

However, again in summary, if you can’t figure out what the access rights for horse or bicycle should be, you should probably assume private. The same “big caveat” as above applies - it’ll be difficult to do that in less well mapped areas.

Location: Oldstead Mill, Oldstead, North Yorkshire, York and North Yorkshire, England, YO61 4BL, United Kingdom

After reading this forum topic and commenting that the United Kingdom part wasn’t great because it didn’t consider the different rules in England and Wales, Scotland, and Northern Ireland, I wondered “what should the defaults actually be for England and Wales?”.

Of that table, I think that the rows down to living_street are correct, and of the remaining rows the columns across to moped are also correct. I decided to pick a couple of areas I’m familiar with (one urban, one rural) and look for examples in those areas without explicit access tagging. Based on that it should be possible to suggest some sensible defaults.

path

The default of no for everything through to moped is correct, which leaves horse, bicycle and foot.

path, horse, urban

https://overpass-turbo.eu/s/1P4E

https://overpass-turbo.eu/s/1P4G

Mostly these ways are foot=permissive, and there’s no horse signage. In some of the parks horses might be tolerated; elsewhere likely not. This suggests horse=no here.

path, horse, rural

https://overpass-turbo.eu/s/1P4I

https://overpass-turbo.eu/s/1P4H

Mostly these ways are foot=permissive or =yes, and there’s no horse signage. In some of the parks horse access might be =permissive; in most cases not. This suggests horse=no for these as well.

path, bicycle, urban

https://overpass-turbo.eu/s/1P4J

https://overpass-turbo.eu/s/1P4K

Mostly these ways are foot=permissive. In a large number bicycle access is explicitly disallowed.

path, bicycle, rural

https://overpass-turbo.eu/s/1P4L

https://overpass-turbo.eu/s/1P4M

Mostly these ways are foot=permissive or =yes, and on some (but not as many as the urban ones) bicycle access is explicitly disallowed. However there are also some designated “public bridleways” which should be tagged bicycle=yes but are not, perhaps because bicycle access is legal but implausible

path, foot, urban

https://overpass-turbo.eu/s/1P4O

https://overpass-turbo.eu/s/1P4N

Mostly these ways are foot=permissive. Some may be private

path, foot, rural

https://overpass-turbo.eu/s/1P4P

https://overpass-turbo.eu/s/1P4Q

Mostly these ways are foot=permissive. Some may be private

bridleway, horse, urban

https://overpass-turbo.eu/s/1P4R

https://overpass-turbo.eu/s/1P52

There are only a few of these; most should be horse=yes (although perhaps slightly impractical), a smaller number horse=permissive.

bridleway, horse, rural

https://overpass-turbo.eu/s/1P4U

https://overpass-turbo.eu/s/1P4V

https://overpass-turbo.eu/s/1P4W

The vast majority should be horse=yes, a smaller number horse=permissive.

bridleway, bicycle, urban

https://overpass-turbo.eu/s/1P4X

https://overpass-turbo.eu/s/1P4Z

https://overpass-turbo.eu/s/1P50

Most should be bicycle=yes, some =permissive.

bridleway, bicycle, rural

https://overpass-turbo.eu/s/1P53

https://overpass-turbo.eu/s/1P54

https://overpass-turbo.eu/s/1P55

The vast majority should be bicycle=yes, a smaller number bicycle=permissive or bicycle=no.

bridleway, foot, urban

https://overpass-turbo.eu/s/1P58

https://overpass-turbo.eu/s/1P59

The few that there are should be foot=yes.

bridleway, foot, rural

https://overpass-turbo.eu/s/1P5b

https://overpass-turbo.eu/s/1P5e

https://overpass-turbo.eu/s/1P5f

All should be foot=yes I think.

cycleway, horse, urban

https://overpass-turbo.eu/s/1P5i

https://overpass-turbo.eu/s/1P5y

Mostly these ways are foot=permissive, and there’s no horse signage. In some of the parks horses might be tolerated; elsewhere likely not.

cycleway, horse, rural

https://overpass-turbo.eu/s/1P5v

https://overpass-turbo.eu/s/1P5w

Very few of these; those that there are are likely horse=yes or horse=permissive.

cycleway, bicycle, urban

https://overpass-turbo.eu/s/1P5x

https://overpass-turbo.eu/s/1P5T

Mostly these should be bicycle=yes; a couple perhaps =permissive.

cycleway, bicycle, rural

https://overpass-turbo.eu/s/1P5A

Very few of these; those that there are are likely bicycle=yes.

cycleway, foot, urban

https://overpass-turbo.eu/s/1P5S

https://overpass-turbo.eu/s/1P5U

Mostly these should be foot=yes; a couple perhaps =permissive.

cycleway, foot, rural

https://overpass-turbo.eu/s/1P5V

Very few of these; those that there are are likely foot=yes.

footway

Of the values on that line, I believe that defaulting to “no” for motorcar through bicycle is correct. That just leaves us “foot” to think about:

footway, foot, urban

https://overpass-turbo.eu/s/1P5F

https://overpass-turbo.eu/s/1P5G

Most of these are foot=yes; some are foot=permissive.

footway, foot, rural

https://overpass-turbo.eu/s/1P5H

https://overpass-turbo.eu/s/1P5J

https://overpass-turbo.eu/s/1P5K

Most of these are foot=yes; some are foot=permissive.

pedestrian

Of the values on that line, I believe that defaulting to “no” for motorcar through bicycle is correct. That just leaves us “foot” to think about:

pedestrian, foot, urban

https://overpass-turbo.eu/s/1P5M

The vast majority of these are foot=yes; the rest perhaps foot=permissive.

pedestrian, foot, rural

https://overpass-turbo.eu/s/1P5O

This is basically not a thing in rural areas.

which means:

            horse  bicycle  foot
path        no     no       permissive
bridleway   yes    yes      yes
cycleway    no     yes      yes
footway     no     no       yes
pedestrian  no     no       yes

What would be interesting to know is whether people agree - both in this area and in other urban and rural areas in England and Wales.

Location: Kingstone, East Staffordshire, Staffordshire, England, United Kingdom

Yet another diary entry about vector tiles

Posted by SomeoneElse on 29 May 2024 in English. Last updated on 11 November 2024.

A simple "shortbread" / "VersaTiles Colorful" maplibre-gl vector map

Lots of people have written diary entries and there have been other announcements and demos. You might wonder why we need another?

The idea of this is to provide a “soup to nuts” guide in a similar style to the existing “Switch2osm” Serving Tiles guides for raster tile servers.

Introduction

There are two major pieces to this. The first piece creates a set of vector tiles that can be served by a web server. The second provides a way for clients to access that data - and clients also decide how to display it.

The code in this example is for web clients, but it’s also possible to create other sorts of clients too (for example, Android or iOS apps).

One important choice is “what data should be in in the vector tiles, and at what zoom level”. It’s not possible to have everything in OSM available at every zoom level - the size of each tile would just get impractically large. Handily, people have already created schemas that target different use cases. One general purpose one is shortbread.

That documentation doesn’t just define what data is in the tiles, it also covers how to create them. The actual software used to create the tiles is Tilemaker. The documentation of both of those is pretty much good to follow directly - what follows below is basically just a worked example.

As an example map style, I’ve used “colorful” from VersaTiles. The implementation below differs slightly from the examples on VersaTiles’ site, in order to make it clearer how it all works together; but do be aware that that site offers a lot more than just a couple of web vector map styles.

Setting up a server

As a test server I chose a CAX21 at Hetzner - that has enough memory and disk for the worked example below, and is relatively cheap (€0.25 a day or so). Other cloud providers are available; and of course machines with this sort of specification is going to be available to many people locally too.

I chose Debian 12 as the operating system, selected IPV4 + IPV6, added my ssh keys, made a name up, and added that as a fully qualified domain name to my DNS. I then created a non-root account for “normal” usage and added it to the “sudo” group. I turned off password access to ssh and forced all logins to use ssh keys.

I installed some initial software

sudo apt install emacs-nox mlocate screen git tar unzip wget bzip2 apache2 socat net-tools curl

In that list “emacs-nox” is just my preferred editor and “socat” is used when obtaining an SSL certificate for the web server which we’ll cover below. They’re just peripheral to serving tiles.

At this stage browsing to “http://myserverFQDN” (obviously use your name instead of the text “myserverFQDN”) should display an “it works” page.

sudo apt install postfix mailutils

Also peripheral to the main job in hand, “postfix” is a mail server and “mailutils” provides command-line mail access. These are useful on a remote server for reporting when e.g. scripts have failed, but are less essential if the server is local. When installed, postfix asks how mail should be sent (“Internet Site” in this example) and what the mail name should be (I used the FQDN from earlier).

With an internet-facing server with a known name it’s easy to obtain a free SSL certificate using a service such as Letsencrypt or ZeroSSL. I used acme.sh for this, but there are lots of other options. Once I had the certificate files I then ran:

a2ensite default-ssl
a2enmod ssl

and edited “/etc/apache2/sites-enabled/default-ssl.conf” to add

SSLCertificateFile      /root/.acme.sh/myserverFQDN_ecc/fullchain.cer
SSLCertificateKeyFile   /root/.acme.sh/myserverFQDN_ecc/myserverFQDN.key

below “documentroot”, and then ran “systemctl reload apache2”.

Browsing to “https://myserverFQDN” now works without an SSL error or warning. I set up an iptables firewall to block access that I didn’t want but allow e.g. web and ssh traffic, over both ipv4 and ipv6. Various online guides exist, including this one. When you’re happy that both ipv4 and ipv6 are configured correctly:

sudo apt install iptables-persistent

and say “yes” to saving both ipv4 and ipv6 rules.

Shortbread and Tilemaker

When logged in as the non-root user you created above, we’ll need to install some prerequisite software:

sudo apt install gdal-bin apache2-dev libsqlite3-dev

and then obtain some other software that needs building. First, “mod_mbtiles” is an add-on to apache to allow it to server vector tiles.

cd
mkdir src
cd src
git clone https://github.com/systemed/mod_mbtiles
cd mod_mbtiles
sudo apxs -lsqlite3 -i -a -c mod_mbtiles.c
sudo systemctl restart apache2

Next, get shortbread-tilemaker, which defines the schema that we’re using - it comes with the rules that Tilemaker will follow.

cd ~/src
git clone https://github.com/shortbread-tiles/shortbread-tilemaker

and then Tilemaker itself

cd ~/src
git clone https://github.com/systemed/tilemaker

Now we need to build tilemaker locally as described here.

sudo apt install build-essential libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev liblua5.1-0-dev libshp-dev libsqlite3-dev rapidjson-dev zlib1g-dev
cd ~/src/tilemaker
make
sudo make install

Next, download some data. I’m going to use “Britain and Ireland” from Geofabrik. At the time of writing this (just) fits into this specification of server.

cd
mkdir data
cd data
wget https://download.geofabrik.de/europe/britain-and-ireland-latest.osm.pbf

We need some “background data” - there’s a script to get that in the “shortbread-tilemaker” directory:

cd ~/src/shortbread-tilemaker
time ./get-shapefiles.sh

We can now run tilemaker. The bounding box here covers most of Europe (it needs to be bigger than our data download area). Generating tiles for the whole world takes much longer so we won’t do that. Use Geofabrik’s tile calculator to choose appropriate values.

cd ~/src/shortbread-tilemaker
time tilemaker --config config.json --process process.lua --bbox -11.39,48.44,2.28,61.36     --input ~/data/britain-and-ireland-latest.osm.pbf  --output ~/data/shortbread-tiles.mbtiles

When generated, copy the tiles into the web server drectory

sudo cp ~/data/shortbread-tiles.mbtiles /var/www/html/

and edit your appache config files (by default, “000-default.conf” and “default-ssl.conf”) to add:

MbtilesEnabled true
MbtilesAdd shortbread-tiles /var/www/html/shortbread-tiles.mbtiles

below “DocumentRoot”, and restart apache.

VersaTiles Colorful

One of the examples listed above, Paul’s TileKiln demo includes VersaTiles “colorful” style. We’ll fetch a copy of that and edit it to work with our tiles. As your non-root user:

cd ~/src
git clone https://github.com/pnorman/tilekiln-shortbread-demo
cd tilekiln-shortbread-demo
wget https://demo.tilekiln.xyz/shortbread_v1/tilejson.json

Open “colorful.json” in a text editor. This definition:

"glyphs": "https://tiles.versatiles.org/assets/fonts/{fontstack}/{range}.pbf",

defines where fonts (for text styles) are loaded from. It defaults to VersaTile’s own site, which is fine for the purposes of this demo. This definition:

"sprite": "https://tiles.versatiles.org/assets/sprites/sprites",

defines where all the icons on the map come from. They’re all in one big “sprites.png” file and a separate “sprites.json” file defines which one is where.

Finally, edit the line

"url": "https://demo.tilekiln.xyz/shortbread_v1/tilejson.json"

to instead read

"url": "https://myserverFQDN/tilejson.json"

(or “http” if you have not set up an SSL certificate for your website) We’ll also edit our local copy of “tilejson.json” to replace

["https://demo.tilekiln.xyz/shortbread_v1/{z}/{x}/{y}.mvt"]

with

["https://myserverFQDN/shortbread-tiles/{z}/{x}/{y}.pbf"]

That “shortbread-tiles” matches the name in the “mod_mbtiles” confguration above

Next copy “index.html” and your modified “colorful.json” and “tilejson.json” to the root of your web server “/var/www/html”. Restart apache and start a new private browser.

Browse to

https://myserverFQDN/index.html#18/54.501519/-8.190062

and you should see a map!

If you don’t, then something has gone wrong. After correcting whetever it is, you’ll probably need to restart Apache and/or close your private browser and restart it. Browser web developer tools (often control / shift / I), especially the “network” tab, can be helpful at understanding what has gone wrong.

Location: Larganhugh, Melvin Electoral Division, Manorhamilton Municipal District, County Leitrim, Connacht, Ireland

Example of different map styles

Let’s imagine that you’re a pizza delivery company, and you’ve got an app that shows where you are, where your customers are and where a delivery person is between the two. Obviously you need some sort of map that shows the three in context. You can’t use Google Maps for cost or other reasons, and whatever framework your using will accept raster tiles in the almost universal format https://server/Z/X/Y.png, so why not use OpenStreetMap’s standard layer? After all, it’s free!

Well:

  • It’s not free, in the sense of free laid out in the tile usage policy. That doesn’t mean that OSM doesn’t tolerate or even encourage some use of those tiles, but it does mean that you have no service level agreement - you probably won’t even get warned if your use is prevented at some point in the future.

  • It’s not a great background map. The “OSM Carto” style tries to do two things at once - it tries to provide feedback to OSM mappers and it tries to be a “nice” standalone map. Both of those make its use as a background less than ideal. To see some alternative map styles (some of which are designed as background maps) have a look at openwhatevermap.xyz.

  • It’s updated on the fly. While OpenStreetMap gets surprisingly little vandalism considering the scale and visibility of the project, it does get some; and any map that is instantly updated will show what there is until the vandalism is fixed both in both the map data and the server-side infrastructure. Your pizza delivery company probably only needs to process updates to a map layer for a small area and when new roads and new housing estates are built; perhaps once every few months or so.

So what can you do?

It’s important to remember that OpenStreetMap’s Data is still free. You’re welcome to use that, and plenty of companies are willing to help.

If you can’t afford that, and can only spare about the price of an average-sized pizza a month, you can do it yourself. Deploying a map as described on this page could cost under €10 per month. If you want to run occasional updates, that’s documented too - just run it whenever it’s convenient for you.

– Andy

(a member of the DWG, and also a maintainer of the “switch2osm” site, but writing this in an entirely personal capacity)

The screenshot at the top is from openwhatevermap - click through from there to see the details of each style and terms of use.

Location: Pizza, Uvu Uda, Askira-Uba, Borno State, Nigeria

Bus Stops

Posted by SomeoneElse on 18 March 2024 in English.

There’s lots of data stored in OSM about bus stops, but often maps and apps created with OSM data don’t make much use of it (with OsmAnd being the notable exception). For here’s a bus stop as shown by OSM Carto:

Bus stop in York in OSM Carto

You can see that it’s a bus stop, and you’d be able to see the name if you could zoom in a bit more. However, in OSM there’s actually lots more information. For the map styles that I look after (both web-based raster maps and for Garmin devices) I tried to add a bit more detail. Here’s the result:

Bus stop in York at map.atownsend.org.uk

The bus stop icon has several extra elements that can be varied. The main part is the bus - still present but disused stops get a black “x” instead. Most bus stops have a pole. and that is shown to the right. The “r” indicates that there’s some sort of real-time display at the stop and the “s” that there’s a button that people can press to hear an announcement saying when the next buses are due. A “t” is shown if there’s just a timetable. The stop name itself is composed of several components - the name field itself, and also if set ref and naptan:Indicator, often “opp” or “adj” in the UK.

A feature of bus stops in my local area is that most also have a QR code of the form http://deps.at/?32900012, which redirects to a website for that stop that shows the same information as on real-time displays. The parameter is the naptan:NaptanCode. Unfortunately this doesn’t work for all stops, so I’ve manually added the website locally only where it actually works. The website is shown on the stop when you zoom in.

Bus stop showing website

The full variety of symbols can be seen in the legend here. Zoom in to see larger icons.

Several tags are used to decide whether a bus stop pole is likely to be there or not, and I’ve used "physically_present=yes is used on disused bus stops to indicate that a pole exists but they’re not in use. Some in my local area are signed as not in use, but the majority are not - the only indication is uaully the lack of a timetable.

Newer buses locally do have displayed and spoken announcements of stop names on board, but sometimes the name on the stop, the name displayed on the bus and the name announced on the bus are all different - see for example here and here. I’ve used bus_display_name and bus_speech_output_name where these differ. I made those last two names up; I couldn’t see anything at taginfo and a mailing list post didn’t generate any other suggestions. If either of the other names isn’t contained within the main one, I’ve appended them to the end, like this:

Bus stop with multiple names

Of course, if someone can suggest a better tag for these names I’m all ears (but not alt_name or some semicolon=separated monstrosity as neither of those would explain which name is which).

Maps for Garmin are similar, except that relevant information is appended to the name directly. Also note that a number of Garmin devices such as older Garmin Nuvi satnavs (and presumably newer Garmin drive ones) support speech output directly.

Location: The Rise, Acomb, York, York and North Yorkshire, England, YO26 5HL, United Kingdom

Showing things at higher zoom levels

Posted by SomeoneElse on 6 February 2024 in English.

Signpost near Husthwaite

Although the raster maps at maps.atownsend.org.uk support zoom levels up to 24, until recently I’ve not made much use of that for showing extra data. However, there is a lot of room at these high zoom levels - as the picture above shows, enough for all the directions on this signpost here.

The name is shown as normal at lower zoom levels, then as you zoom in the directions are shown too, as you can see here.

Location: Acaster Mill, Husthwaite, North Yorkshire, York and North Yorkshire, England, YO61 4PG, United Kingdom

What's new on the maps at map.atownsend.org.uk

Posted by SomeoneElse on 28 December 2023 in English. Last updated on 6 February 2024.

Norfolk coast near Cley

Tidal and non-tidal wetland

A major rewrite here takes into account tags such as natural, reef, wetland, surface and tidal before deciding how to show wetland areas. See the picture above, which is here, and here in OSM.

The beach between high and low tide can be clearly seen here (in OSM, here). There are blue dots in the sand rather than black. A deliberate decision was taken to show more detail for areas above low tide. See e.g. here between Wales and the Wirral (see here in OSM).

Island and islet names

Skye

Island and islet names are shown based on their size. Try going here and then zooming out - small island names disappear first, with the larger ones such as Skye disappearing much later.

Width of rivers and streams

The Oxford Canal and the Cherwell in Cropredy

Many rivers and streams don’t have water areas mapped for them, which means that maps have to decide what to do at higher zoom levels. The Cherwell on the right on the picture above is an example of that. For rivers and canals, I’ve tried to match what “the actual width of a small river” might be. For an example, see here just up-river from the previous picture. At high zoom levels, the river’s width is about the same fraction of the bridge length. If you look at the imagery here you’ll see that the width is about right.

The same principle is applied to streams, drains and ditches, although of course they are narrower.

Cycle routes, National Byway etc.

South of the Humber Bridge

Long route “names” are a challenge in OpenStreetMap. I’ve used various methods to try and suppress these, but it’s not always successful. In the screenshot above you can see this part of the Viking Way which aparently is named “Viking Way (Barton-upon-Humber to Barnetby)”, and this cycle route called “NCN 1 Humber Bridge east alternative”. Thankfully, some examples can be special cased:

Castle Howard

Here the main National Byway and one of the loops have been detected and display using just “NB” and “NB (loop)”, which is essentially what appears on the signs - the signs do not say (in this example) “Malton Loop”.

I’ve also tried to distinguish national and regional routes:

WYCR in Wetherby

Here the National Cycle Network route 665 and the regional West Yorkshire Cycle Route can be seen - the regional route has an “r” appended to the name. Options for other distinguishing features are limited - colour is used to tell the difference between foot, horse and cycle routes already.

Lots more historical icons

The historic key is an absolute goldmine, if you sidestep the “unhelpful” keys (such as “yes”). These maps are created for Britain and Ireland, so I’ve concentrated on getting values used in Britain and Ireland shown. This has been a bit of a challenge - objects under this key include palaeontological sites like this, archaeological and historic sites from many periods, many different archaeological site types. Many are fortifications, of many different types. Many ancient sites cross over between uses (for just a taster of some of the issues, see here), so deciding how to show them can be a bit of a “choose your own adventure”.

Historic part of map legend

What I’ve ended up with can be seen here. There are about 50 currently - scroll to the right to see them all!

Archaeological features incorporate four vertical posts in the icon, along with (say) a ring for a ringfort and a hill for a hillfort. Ringforts can be tagged in at least four different ways and hillforts five (that I’ve found so far), so deciding what goes in what bucket is a challenge. Other features also try and use variations on a theme (on a “standard tower”, on a building, on a church, or on a stone).

Hopefully the result fits in well with the rest of the landscape:

Western part of Dingle / An Daingean peninsula

Location: Reask, Marhin ED, Kenmare Municipal District, County Kerry, Munster, V92 P681, Ireland

ChangesetMD

Posted by SomeoneElse on 6 August 2023 in English.

There’s lots of software around to work with OpenStreetMap data - querying it, creating maps from it, using it for navigation. One area that there has historically been less support is analysing OSM changeset data. As an example, here is one of mine.

However, many years ago Toby Murray wrote ChangesetMD. That can be used to maintain a database of changeset information (tags, discussions, etc.). Martijn van Exel updated that to a recent version of Python and I made a couple more changes to support very recent Python versions and made the replication more scriptable.

Downloading changeset data

Over on the planet.osm.org site, there’s a download for all the changeets generated at the same time as the weekly “planet” file is created, and also one for all the changeets and discussions as well. The changesets-only one is just over 6GB (bzipped), and the one with discussions as well is only about 250MB more, because most changesets don’t have discussions.

If you’re not interested in changeset data dating back to 2012 you don’t need to download this file; you can just start replicating from whatever point in the past you are intereted in starting from.

Installing the software

If you’re on Debian or Ubuntu, you’ll likely want to follow these instructions from a non-root user account of your choice (substitute that account for “youruseraccount” in the instructions).

Running it for the first time

From the virtual account created by the installation, which you can reenter by running

cd /home/${youruseraccount}/src/ChangesetMD
source .venv/bin/activate

Run something like this

python changesetmd.py -d changesets -c -g

The “-g” is optional and initialises the database to story geometric data. “changesets” in the line above is just the database name.

Loading a changeset dump file

To load the database with changesets and discussions:

python changesetmd.py -d changesets -g  -f ~/data/discussions-latest.osm.bz2

Adjust this to wherever you’ve downloaded discussions-latest.osm.bz2; if you are not interested in changeset discussions you can use changesets-latest.osm.bz2 instead.

Setting up replication

This section in the readme explains how to find out the date of the latest data you’ve imported from, and how to find out which replication file corresponds to that date.

Alternatively, if you haven’t loaded a dump file you might want to “just load all the changesets from the last year” - do do that find the state file in the replication directories that matches “about a year ago” and initialise the replication from there. To actually initialise the replication, do this:

cd /home/${youruseraccount}/src/ChangesetMD
source .venv/bin/activate
psql changesets
update osm_changeset_state set last_sequence = 5607928;

Again, “changesets” here is the database name. “5607928” is the replication number which will vary depending on where you want to start replication from. 5607928 corresponds to https://planet.osm.org/replication/changesets/005/607/928.state.txt , which is 18:43 UTC on 3rd August, 2023.

To run replication once, run this command

python changesetmd.py -d changesets -r -g

Again, “changesets” is just the database name and “-g” means “process geometry as well”. This will run though all pending replication files, which may take some time. You can monitor the process from psql by running “select * from osm_changeset_state;”. The “last_sequence” value is updated as it progresses but “last_timestamp” is only updated when replication is complete, so look at the former, not the latter.

When in progress the state table might look like:

changesets=> select * from osm_changeset_state ;
 last_sequence |       last_timestamp       | update_in_progress 
---------------+----------------------------+--------------------
       5607985 | 2023-08-02 00:59:46.096662 |                  1
(1 row)

when replication has completed, “update_in_progress” will be set to “0”.

Running replication from cron

A shall script “call_changesetmd_replication.sh” has been written to check that changeset replication is not already running, and if it is not to run it.

That is designed to be run from a cron job like this:

*/5 *   *   *   *    /usr/local/sbin/call_changesetmd_replication.sh >> /var/log/tiles/ChangesetMD.log

That runs every 5 minutes; the location /var/log/tiles/ was chosed for the log because if rendering database replication is already set up that’ll probably go there too.

Clearing replication flag at restart

A script “reset_changesetmd_replication.sh” has been written to do this. The version distributed in the script is written to sudo to the database owner from root, so that it can be run in a startup script somewhere.

What can it do

Counting changesets by a user

changesets=> select count(*) from osm_changeset where user_name = 'SomeoneElseSC';
 count 
-------
   2175
 (1 row)

Displaying details of changesets

changesets=> select id, num_changes, tags -> 'comment'  from osm_changeset where user_name = 'SomeoneElseSC' and created_at > '2023-08-01';
    id     | num_changes |                     ?column?                     
-----------+-------------+--------------------------------------------------
 139486735 |           2 | Determine roads lane count
 139486744 |           5 | Specify road surfaces
 139486795 |           2 | Specify whether public transport stops have bins
 139486799 |           2 | Add whether public transport stops are lit
 139486859 |           1 | Specify crossing types
 139486892 |           1 | Specify whether crosswalks have tactile paving
 139486897 |           1 | Specify cycle barrier types
 139486904 |           1 | Specify cycle barrier installation
(8 rows)

Changesets within an area

The “ST_MakeEnvelope” below is an area around “null island”:

changesets=> select id, user_name, tags -> 'comment' FROM osm_changeset c, (SELECT ST_SetSRID(ST_MakeEnvelope(-0.1,-0.1,0.1,0.1),4326) AS geom) s WHERE ST_CoveredBy(c.geom, s.geom) and created_at > '2023-06-01';
    id     |     user_name      |              ?column?               
-----------+--------------------+-------------------------------------
 137125242 | TV Sand in Taufers | 
 137125690 | TV Sand in Taufers | 
 137233374 | ivanbranco         | deleted null island drinking waters
(3 rows)

With different imagery sources

changesets=> select count(*) from osm_changeset where created_at > '2023-05-01 00:00:00' and created_at < '2023-06-01 00:00:00' and tags -> 'imagery_used' like '%Maxar%';
 count 
-------
 80407
(1 row)

changesets=> select count(*) from osm_changeset where created_at > '2023-05-01 00:00:00' and created_at < '2023-06-01 00:00:00' and tags -> 'imagery_used' like '%Bing%';
 count  
--------
 274372
(1 row)

With certain changeset comments

changesets=> select id, user_name, tags -> 'comment' from osm_changeset where tags -> 'comment' like '%muppetry%';
    id    |     user_name      |                                               ?column?                                                
----------+--------------------+-------------------------------------------------------------------------------------------------------
 27073588 | SomeoneElse        | Added a couple of hedges in the vicinity to try and prevent further armchair muppetry.
 67493564 | SomeoneElse_Revert | Revert more muppetry in USA.  See https://www.openstreetmap.org/user_blocks/2545 and previous blocks.
 45959206 | SomeoneElse        | Undoing more road merging muppetry
(3 rows)

(oops)

Changeset comments

changesets=> select * from osm_changeset_comment where comment_changeset_id = 126313717;
 comment_changeset_id | comment_user_id | comment_user_name |    comment_date     |                                                      comment_text                                                      
----------------------+-----------------+-------------------+---------------------+------------------------------------------------------------------------------------------------------------------------
            126313717 |            5359 | user_5359         | 2022-09-22 19:30:10 | Hello! Please have a look on http://overpass-turbo.eu/s/1m76. What is the meaning of the tag do = View from path;Bing?
            126313717 |           61942 | SomeoneElse       | 2022-09-22 19:39:35 | Thanks - just a typo, now fixed.
(2 rows)
Location: Charlesworth, High Peak, Derbyshire, East Midlands, England, United Kingdom

For many years I’ve used Garmin devices for both for navigation and for collecting data for OSM. As well as lots of premade maps in different styles it’s actually pretty easy to tinker with the map style yourself, although the OSM wiki makes it seem much more complicated than it actually is. It’s also pretty easy to see what OSM keys map to what values - there’s a file for points, one for lines and one for polygons that shows what OSM key and value corresponds to what Garmin feature.

I also maintain a web map style that tries to be much more inclusive than other web maps in terms of what it shows (have a look around the map legend for that), and thought that it’d be great to do the same for Garmin maps too. The web map style uses a lua script to preprocess OSM data before the CartoCSS code deals with it, which makes the latter much, much simpler. It turns out that exactly the same approach works when creating Garmin maps too, as described on this page.

The resulting map style includes data from around 250 OSM keys and over 2000 OSM values, and browsing 3 text files to see what is shown as what is no longer an option. However, all of the OSM keys and values used by this project have been uploaded to taginfo, so we can use that for documentation. This page shows all the tags used. In each case, the “How this key/tag is used in the project” column has been updated with what extra processing happens to the item and which Garmin search menu it appears in. For example, if you search for shop=shoes you’ll see “shown in brackets; ‘Shopping / Apparel’”. “Shown in brackets” means the OSM tag value (“shoes”) is appended to the name on the devices so that it appeats as e.g. “Clarks (Shoes)”; “Shopping / Apparel” means it’s on the “Apparel” submenu on the “Shopping” main menu (the one you get to by pressing “Find” on the device). You can also search “tags used by this project” for either keys or values. See for example the search for “fish_and_chips” below, and see how all matching values are shown, and also that in some cases the search menus to use vary depending on whether the object is fast_food or a restaurant:

The other side of the coin to this is “for each Garmin menu item, which OSM keys and values appear on it”. That is listed in tables in a map legend here. As an example, you can see that the “Fast Food” submenu below “Food and Drink” is used for “Pie-led fast food”, which means “amenity=fast_food” and a “cuisine” value of any of “=pasties”, “pasty”, “cornish_pasty”, “pie” or “pies”.

That document also describes the special processing used for e.g. public footpaths, long distance hiking routes, quality control information (“is this road lit” etc.) and more.

Currently a build (of maps for Great Britain) is done every week, but producing maps for other areas is simple, given that the file to process is downloaded from Geofabrik at the top of the script - no other code changes.

Location: Bootham, Bishophill, York, York and North Yorkshire, England, YO30 7XZ, United Kingdom

Screenshot of switch2osm page

I’ve added a new page to the switch2osm guide: “Manually building a tile server (Debian 12)”.

Mostly it’s minor changes only from Debian 11 and Ubuntu 22.04 - new versions of software, that sort of thing. Where new manual steps have to be carried out, the guide describes them. Debian 12 itself does have some differences - “syslog” is no longer created by default, so debugging changes slightly.

I’ve also updated a couple of other pages such as the replication ones to reflect that Debian 12 is now a supported operating system.

Separately to that, I’ve moved map.atownsend.org.uk (which uses a related may style) from an Ubuntu 22.04 server to a Debian 12 one. There was nothing wrong with the old one, but the hosting provider I use was offering higher spec ARM servers for essentially the same price as the old AMD one I was using, so it made sense to move.

Operational differences that I’ve noticed (apart from it just being faster, because it’s on a higher specification server) is that early morning low-zoom rerendering takes longer because more tiles are marked as dirty - the reason for this seems to be bugfixes within the osm2pgsql processes that handle replication.

Location: Thurles Townparks, Thurles Urban, The Municipal District of Thurles, County Tipperary, Munster, Ireland

Most hedges have been added to OpenStreetMap as lines. Most renderers show something like this:

hedge rendering 1 from wiki page

and everyone’s happy.

However, from the beginning of OSM, people have mapped some hedges as areas, so for example something like this:

hedge obviously mapped as area in OSM

is clearly meant to be an area. The map style at map.atownsend.org.uk inherited what “OSM Carto” did in 2014, which was to show linear hedges as lines (using one bit of code) and area hedges as areas (using another). This works fine here:

hedge obviously mapped as area on map

However, in some cases there are problems. In an osm2pgsql database, an object can only be either an area or a line, but not a bit of both. If a tag that is thought to apply only to lines is found on an area, it will be ignored. Another effect is that if a hedge is drawn around an obviously area object (a field, for example), then the hedge will also be considered an area, if hedge areas are “a thing” in that map style:

See for example here:

hedge drawn around a field

which results in this “very large area hedge”:

linear hedge shown as area by mistake

More details and links to previous discussion can be found on the github issue here. The solution was this - if another tag might be making the item into an area feature, assume that the hedge is linear, but if no other tag is doing that, assume that the hedge is an area.

This results in the correct rendering here:

linear hedge shown as area by mistake

As an aside, in 2019 OSM Carto removed support for area hedges, and numerous people complained about that change. The result is that OSM Carto gets the “field” one above right but fails basic tests such as the example at the top of this diary entry:

hedge shown incorrectly by OSM Carto

To be fair - it’s not entirely the OSM Carto developers’ fault - part of the problem is mappers combining “features they expect to be linear” and “features they expect to be areas”, and partly that is because OSM does not have an area data type.

Although it’s not perfect, the solution here is clearly a better one than what they went with.

As another aside, the mismapping of hedges with barrier=hedge; area=yes when (according to the imagery) they are clearly not hedge areas is a real problem. As an example, if you look at the imagery here you can see that’s clearly a field, not a very big hedge. However (before some enthusiast decides a mechanical edit is in order) not all of these are mistagged - this one is just a very big hedge.

For completeness, from a database count there are 5999 “area hedges” in UK/IE, and 3026 “linear hedges around other area features”. Some of those “area hedges” should probably be something else (for example, way 1086001254 is a bit of a stretch as a hedge), and some of those “linear hedges” might actually be areas if an area hedge is, say, it’s very own nature reserve.

Location: Selby, North Yorkshire, York and North Yorkshire, England, United Kingdom

As there have been lots of updates recently, I’ve made a new release of all of the code behind map.atownsend.org.uk

There are releases for four repositories - the lua code that does all the hard work, the map style that determines what it looks like, the map legend, and the website for the map itself.

Here’s a summary of what’s new:

Natural features

Rocky features are now shown in more detail:

I’ve been struggling for some time to get a distinct representation for different landuse features - scree different from bare_rock, for example. I finally came up with a series of different dot patterns that hopefully differentiates.

Tidal rocks, beaches and mud etc. are shown with blue dots:

The fact that OSMers mapped tidal sand and rock different to non-tidal was something of a surprise to me, but it is mapped consistently.

Prominent single rocks are shown in black:

climbing boulders with a green flash:

and that’s different again to artificial (for example, indoor) “climbing walls” that are shown in all green.

Historic and archaeological features

People who know more about the subject than me have labelled historic tagging in OSM as a bit of a mess. One basic problem is that different tags are used for graduations of the same thing, like these examples:

  • historic=castle
  • historic=ruins; ruins=castle
  • historic=archaeological_site; archaeological_site=fortification; fortification_type=castle

In addition, there are roughly three different parallel way to break down “historic=archaeological_site” -

  • archaeological_site/site_type=
  • fortification_type=
  • historic:civilization=* (and even then there’s variation, like “historic:period=*”)

Sometimes I’ve had to use these subtags to determine what things “really are”, so there are a lot of entries at taginfo where this map is the “only consumer” of certain types of data. The resulting tree diagram where multiple paths lead to the same branch is worth a separate discussion in its own right, but for now let’s just look at the pictures :) .

However, in amongst the confusion, it has been possible to show many more archaeological features individually, including stone circles:

More historic features have unique icons, like this monastery:

There are lots of other examples, as can be seen in the legend here:

Location: Seamer, North Yorkshire, York and North Yorkshire, England, United Kingdom

Community.osm.org - how's it going?

Posted by SomeoneElse on 25 March 2023 in English. Last updated on 28 March 2023.

The new forum “community.osm.org” has been going for a while now, so maybe it’s useful to have a look at how things are going.

There’s obviously lots that goes into creating that forum as a site where people can share ideas - there’s the forum software itself, and the people looking after the technical administration of the site, the migration of the old forum (which has just happened) and the help site (planned for later), the various implementation decisions that got us to here, and also the people looking after content moderation (which is more actively managed than before). Of all of these, this diary entry is really only about the Discourse software itself.

I’ll not comment here about the future migration of https://help.openstreetmap.org/ to Discourse and the work required within Discourse to support that, since it would be unfair to judge something that has not happened yet.

Full disclosure - I’m one of the moderators of a couple of categories in the forum, but this is very much a personal view.

What’s good:

The software is actively maintained, unlike the old FluxBB forum software, or OSQA, which is used for the help site.

It’s working! Some communities that might have been a bit quiet or spread over private forums are now able to talk together much easier than before.

Searching works, with some caveats around the UI (see below for that). This may sound obvious, but mailing lists search at for example talk-gb can be a bit of a pain to use - a page such as this only shows the subject and the name of the poster, not the date of the message.

You can avoid “me too” answers (but see “reaction icons” below).

There’s a translate button on every post that supports the most common languages. This reduces the “echo chamber” effect that some forums had previously (and some other OSM channels still do now).

For browsing and reading, most things work on mobile. Initial login is slow, but it works (usually, eventually). It’s certainly better than OSQA which is not at all easy to use on mobile and needs a lot of zooming in and zooming out.

The barrier to entry is much lower than e.g. Telegram. If you have an OSM account, you can log in. You don’t need to e.g. provide a mobile phone number to a third party that you do not necessarily trust.

You can do most things by email (with caveats). See here and here. Email threading was nonexistent in received emails before a recent Discourse upgrade, but this has now been fixed.

You can automatically upload pictures without needing a separate hosting site (unlike, say, mailing lists).

You can use tags as “virtual categories” and post using them. It’s a bit complicated, and new users are never going to figure it out on their own, but it does have the potential to be a useful feature. This is a virtual “United Kingdom” category below “general” and this is a virtual Garmin one.

What’s bad:

The Site layout is poor. https://community.openstreetmap.org/ shows a couple of massive icons, some verbiage and half a dozen links (three on mobile). The remaining 40-odd forums (where most people hang out) are “below the fold” and in no particular order. See also here for more about that.

The forum structure is quite limited, although this may be an implementation decision. Replying by email can cause issues with quoting - depending on the email client, sometimes all of the previous messages is quoted again.

Composing messages on mobile (Firefox) is challenging.

The moderation approach is somewhat restricted by the tools available. When something is reported various messages and numbers are shown but it is not at all clear (except from experience) what applies to the person doing the reporting and what to the person reported. Also, some moderators have complained that they can’t do what they expect to be able to (i.e. not what they were able to do on the old forum).

I know that computer systems tend not to be, but it does seem to be random in places. What one user sees does not match what another user sees.

Pages are slow to load. A 4-second load time (even on a mobile phone) over a fast Internet connection in 2023 is simply ridiculous. See here for more.

It sounds basic, but it’s not possible to see who a reply was to. This is particularly a problem by email, where persons A, B and C reply. If C replies to B there’s nothing (even on the web UI) to indicate that. If B’s reply to A wasn’t visible by email (perhaps because of a local email filter) then it looks like C is replying to A. I mostly work around this by, where relevant, always quoting a bit of message to reply to - that way it’s obvious. See also here and here.

Although searching mostly works, the UI around searching is pretty “user hostile”. To see this, go here and press ^f (normally an in-page browser search) and that keypress is intercepted by Discourse and you are shown “find in topic” instead, which “simply doesn’t find” lots of text. Try searching for “persistent and stable” and it’ll say “no results found” Then browse to here and scroll up a bit, and you can see that that text exists. You can click on it to see the posts, but you can’t search for it. You can press ^F twice and search within page, but because Discourse doesn’t send the whole page to the browser, that search does not work from the top of the page - it’s well into “chocolate teapot” territory. See also here.

The back button does not work.

Users find minimum post length annoying.

The reaction icons are very limited - high on emotion, low on feedback. There is no “vote down” option, which will be essential for “help” migration. There is also no “that’s a really useful comment but I don’t agree with all of it”.

What’s just ugly:

The documentation is piss-poor. See also here for another example of functionality that appears to have been designed under the influence of recreational pharmaceuticals. There’s an about link (which says who the admins and moderators are) and an FAQ (which seems primarily concerned with etiquette guidelines). There is Discourse’s searchable “meta” site (which is good, but you are only going to look for it if you know that such a thing is likely to exist).

The best documentation we have seems to be this which is an introduction to Discourse for OSMers by OSMers. It’s written in German, but you can translate it using Discourse’s built-in translation button..

The upstream release process is a mess. Normally new versions of computer software are “released”. In mid-January a more appropriate zoo analogy would be to say that Version 3 of Discourse “escaped”.

Edit: Link to here removed as that issue is now fixed.

Edit 2: A couple of extra “good” points added - picture hosting and virtual categories.

Location: Lunyo Estate, Katabi, Virus, Entebbe City, Central Region, Uganda

Windows Subsystem for Linux

Posted by SomeoneElse on 25 January 2023 in English. Last updated on 30 March 2023.

This isn’t directly related to OSM, but many times in “software” or “development” OSM channels someone has asked “how do I do X … on Windows 10?”.

The reason that’s often a question is that, for historical reasons, much of the OSM software used to do things has been developed on Linux. That’s great for people working on Linux themselves, and the Apple Macintosh users can normally jury-rig something to run that software too.

Windows users can do the same too, by installing “Windows Subsystem for Linux”. Within Windows, search for “Windows Features”:

In Windows Features, tick the box for WSL and click OK:

Windows will want to restart

After the reboot, search for “Ubuntu”:

As noted in the comments, you may need to add “Ubuntu 22.04.1 LTS” from the Microsoft App Store here. When I deleted and reinstalled WSL and Ubuntu to create these notes, I didn’t need to - but it may be that a Microsoft uninstall didn’t do a clean uninstall. Plus ça Change, eh? :)

Ubuntu will install:

and will then prompt for a userid and password:

After that type “lsb_release -a” at the prompt to see the version installed:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

Apply any pending updates:

sudo apt update
sudo apt upgrade

(this will take a while the first time)

and you can then head over to e.g. https://switch2osm.org/serving-tiles/ to do whatever it was you wanted to do.

When is a path not a path?

Posted by SomeoneElse on 16 January 2023 in English.

Just after the New Year, there were a few reports of people getting stuck and having to be rescued while hiking in the English Lake District.

There are writeups of this in “The Great Outdoors” magazine here and on Alex Roddie’s blog here. They really are worth reading - the consensus on IRC, Mastodon etc. was that the quality of the article was streets ahead of what you might expect to see in the generalist national press.

Lots has been written about how map and app developers can try and convey information to a user beyond “this is a way of getting from A to B” (including an OSM diary entry that I wrote in December 2022), so I won’t go over that again.

However, one particular quote from the Great Outdoors article did stand out for me, and it’s this:

A spokesperson for Keswick Mountain Rescue Team, which carried out the rescues, said: “There is no path via this route – only a scramble of loose scree which also requires the walker to negotiate the rocky outcrop of Slape Crag. It’s the scene of previous callouts.”

The reason why that stood out is that “path” can mean different things to different people:

  • an actual signed path suggesting that people on foot are encouraged to go via a particular route. In England and Wales there’s the concept of “public footpaths” (and public bridleways), which is a legal right of foot (and horse) access across what might be otherwise private land.

  • some indication on the ground that people often go via a particular route

Often the two coincide, and “where you’re supposed to go” matches “where people do actually go” correspond. Sometimes, however they don’t.

As an example, let’s imagine you want to go from the road north of Carlton near Helmsley to the old ruined buildings at Stork House, across the moor. That’s on Ordnance Survey map OL26, and you can also see that mapping at Bing maps here. You’re expecting the public bridleway to follow a track until a small bridge and then head left across moorland to Stork House.

At the western end there’s a public bridleway sign: Picture

and the track is pretty clear: Picture

So off we go, accompanied by the calls of local grouse letting everyone know there is someone unexpected around. Soon, however, there is a bit of a problem - there’s no path visible northeast from the bridge

Picture

Picture

and there’s no “public bridleway” signage. Let’s carry on along the track for now. As the OS 1:25k maps attest, the moorland area is all access land, so public access on foot is allowed. Eventually we get to the guidepost here:

Picture

Picture

Although the paint has mostly worn off, it’s just about discernable as a “public bridleway” sign (well, it was last year when I first mapped it - a year later when I took these pictures it’s a bit less obvious). From there, the path that we need to take to get to Stork House is clear:

Picture

Soon, we can see the ruin of Stork House:

Picture

Not visible in that picture are the rabbits that scattered as soon as I walked down the hill. Eventually, we reach the point where the alleged bridleway that didn’t exist on the ground “joins” the path that we’re on:

Picture

That Garmin picture shows an OSM-derived map that I created superimposed over OS Explorer Mapping. The green dashes are the alleged bridleway, the brown dashes are OSM paths, and the blue line is the route I’ve walked. So is there any sign of the bridleway marked on OS’ mapping from this side?

Not really:

Picture

In that picture, the path we’ve walked in on from the southeast is on the left, and the bridleway route would go across the moorland to the right. There’s nothing obvious there. If we go through the gate into Stork House itself we can see that there are two plastic “public bridleway” signs:

Picture

The blue colour has almost entirely worn off so the direction shown isn’t clear, but one presumably points back the way we came and the other to the northwest, where we’re expecting another bridleway to go.

In conclusion

One thing that I think we can say is that the non-existent-on-the-ground public bridleway doesn’t belong in OSM as any sort of path, as there simply isn’t a path on the ground there. Had there been fingerposts across open moorland then that probably would have been worth adding (perhap with a “trail_visibility=no” tag), but as there’s not even that, it’s really not worth adding as a path, despite appearing on OS maps and (in this area) being available from the local authority under an OSM-compatible licence.

As an aside on “trail_visibility”, it has been used around here. For example, the path across the road from where we started from is here:

Picture

Picture

and isn’t very clear on the ground either, hence the “trail_visibility” tag on it.

The second conclusion is that “on the ground legal signage” of routes can diff from what the local authority thinks the route ought to be, and where it does, and seems on survey to be “more correct” then it’s best that OSM reflects that, rather than the local authority’s view. That’s why, in OSM, I’ve marked the signed route a the bridleway (the blue dashes and dots here. The red line on that map is the overlay of local authority rights of way. Turn that off and you’re looking at data from OSM only.

Copyrights etc. in maps and screenshots:

  • OSM map data wherever it appears is © OpenStreetMap contributors
  • PRoW overlay data is © local authorities under OGL & rowmaps.com
  • The Bing map is labelled by Bing as © 2023 Microsoft
  • The OS data on the Garmin picture is Ordnance Survey © Copyright 2023
Location: Old Kiln, Helmsley, North Yorkshire, York and North Yorkshire, England, YO62 5HL, United Kingdom

How to show paths on a map?

Posted by SomeoneElse on 11 December 2022 in English.

(or, what’s wrong with the general purpose map on my phone that just seems designed just to show me adverts?)

I decided to write this after reading some of the comments on the wiki here and in the community forum here.

People tend to view “things that appear on a map” as “somewhere that they can go”. For example here:

A stroll up Everest

someone who didn’t do their research properly might think that they can just wander along that path to the top of Everest from the south, despite the underlying data suggesting “difficult alpine hiking”. This diary entry is an attempt to try and avoid such misunderstandings.

What options does a map have to different things?

The map at map.atownsend.org.uk shows linear paths and tracks as a single line, It shows legal rights of way (some special categories in England and Wales) and also tries to give some indication of what a walker might expect on that path.

First, before we talk about “showing what a walker might expect”, a note on what options maps have to show linear things differently:

  • colour
  • width of line
  • pattern along the line
  • other things drawn alongside the line

How are those shown?

The colour of the line is used for the legal designation - brown for “motor-vehicley” ones, blue for “horsey or cycley” and red for “foot only” and grey for no legal designation, like this:

Colours for car, horse, foot

In addition, an overlay colour is used for access rights:

Colours for access

The width of the line is only used to control the “visual weight” of features on the final map - it’s tuned by colour at each zoom level, so that a particular sort of feature does not dominate the map at that zoom level.

The spacing of the pattern along the line shows the width of the path (widely spaced for wider than 2m, narrow spaced for less than):

Patterns for path width

Also, slightly different patterns are used for some slightly different legal designations (for example, bridleways and restricted byways).

“Other things drawn alongside the line” are used for tunnels, long fords, bridges and embankments, for example:

Bridges and embankments

What other OSM tags do we want to show?

informal” is sometimes used to show that a path has been created by users rather than by sanctioned by land managers. This only makes sense in places where there are formal paths (which isn’t everywhere), and an informal path isn’t necessarily in any way illegal to use.

trail_visibility” is used to indicate how easy it is to see a path on the ground.

sac_scale” is used to show how difficult a path is to use.

The first two are essentially about showing that a particular path might be difficult to see, or that a walker might not want to follow it because it’s not an “official path”; the third is about how to show (and in some cases not to show at all) paths that might actually be dangerous to an unsuspecting walker.

A final tag that isn’t shown is smoothness. Unlike other modes of transport, a low sac_scale path won’t become impassable to most pedestrians because it’s not very smooth.

What is actually the goal of this map style?

It’s designed to show all legal rights of way there is an actual path (theoretical routes exist where there isn’t really a path - the walk across Morecambe Bay is one example).

Paths that are difficult (high SAC scale), informal or not very visible are de-emphasised in the rendering.

Very difficult paths and very poor visibiliry paths that are not public rights of way are suppressed from the default rendering; an overlay is available for these.

What does this mean in practice?

Here’s a section of bridleway in the North Yorkshire Moors with a “trail_visibility=bad” section in the middle:

Less visible bridleway

An informal human-created shortcut off the Foss Islands Track in York

Informal path

West of Sca Fell, with “difficult” paths excluded by default:

West of Sca Fell

The same view, but with the overlay of “difficult” paths turned on:

with difficult paths

The net result is that

  • walkers who see a path on the map will see a path on the ground
  • paths that are less clear on the ground will be de-emphasised on the map
Location: Isle of Wight Donkey Sanctuary, Ventnor, Isle of Wight, England, PO38 3AA, United Kingdom

Permalinks at map.atownsend.org.uk

Posted by SomeoneElse on 4 December 2022 in English.

The problem

Historically, the map at map.atownsend.org.uk didn’t change the URL as you moved around, and you had to press a “permalink” button to save the current location. This wasn’t ideal, so I had a look around for alternatives. Helpfully, the Leaflet site has a list of suitable plugins. Of those, leaflet-hash was suggested elsewhere. That seems to be still in use, although it hasn’t been updated for a while. It is spectaculary easy to use, and “does what it does” with no problems.

The challenge is that it stores the current location (for example “https://map.atownsend.org.uk/maps/map/map.html#11/54.4900/-3.1098”) but doesn’t store the current layer. That map currently has a choice of 5 base maps (test instances have 6) and 5 overlays:

Layer selector

How to solve this

I had a look for an alternative, and the nearest that I could find was leaflet-hash-plus. The hosting of that seems not to be there at the moment, so the demo does not currently work, but the code does (if you host it yourself). It’s a bit “some assembly required” though - the way it works is that it allows you to encode layer information in a “meta” array and store and retrieve that when needed, which is a bit of a challenge for someone who (like me) isn’t a Javascript developer.

To do that, I need to add handlers for events so that the code knows when the base layer changes or when overlays are added or removed.

The “meta” that I use is just a list of layers, so “HPN” would mean that the default base layer is used, together with the “LA_PRoW” (“P”) and “No vis paths” (“N”) overlays. When the URL changes, the code must change the displayed layers to match. When layers are changed manually using the layer selector, the URL must change. The code makes sure that only one base layer is selected, and overlay layers are removed as required. The mapping between tile layer URLs and the representation in the current site URL is handled here.

What we can now do

West of Scafell Pike

The URL https://map.atownsend.org.uk/maps/map/map.html#16/54.4540/-3.2155/H/N turns on the “No vis paths” layer so that this path appears. It’s suppressed by default on the default layer because “sac_scale” is set to “demanding_mountain_hiking” and “trail_visibility” is set to “bad”, and it doesn’t have a designation tag on it.

UK/IE/IOM boundary

Boundaries are turned off by default, but a URL of https://map.atownsend.org.uk/maps/map/map.html#8/54.143/-4.878/H/B turns them on.

Jugger Howe

This (https://map.atownsend.org.uk/maps/map/map.html#15/54.3771/-0.5528/H/P/N) shows an overlay of the legal rights of way over surveyed paths of varying visibility, and how they significantly differ from what is actually there.

Location: LCPs of Fylingdales and Hawsker-cum-Stainsacre, North Yorkshire, York and North Yorkshire, England, YO22 4QB, United Kingdom