How do I serve localized labels for a minoritized language?

I have created a docker container with github DOT com/Overv/openstreetmap-tile-server and have added 3 regions from https://download.geofabrik.de as a merged pbf file.

Frontend is leaflet.js with map tile address http://localhost:8080/tile/{z}/{x}/{y}.png?lang=gd

I tried hacking the DOCKERFILE with:

ENV LANG=gd_GB.UTF-8
ENV LC_ALL=gd_GB.UTF-8

But that didn’t help either.

Example node that should appear with a gd language label: Node: ‪Glasgow‬ (‪11127374‬) | OpenStreetMap

Any ideas where to find some understandable documentation on how to change the labels to?

Overv/openstreetmap-tile-server uses the OpenStreetMap Carto raster map style which doesn’t have an easy way to change the language of labels. You could do it but it would require changing the code to prefer name:gd over name in quite a few different places as explained here:

You might have a better time with a vector tile setup. Their flexibility can make switching between languages easier. For example here are a couple of vectir maps that can show labels in Scotts Gaelic (you need to pick it from the language menu on the second one as I can’t link directly to it):

https://americanamap.org/#map=9.25/55.9402/-3.8672&language=gd
https://map.atownsend.org.uk/vector/index.html#9.47/55.854/-4.0969

3 Likes

I’d absolutely agree with the above - a vector tile approach will be less work for all sorts of reasons (and fwiw the direct link to the second one in Scots Gaelic is https://map.atownsend.org.uk/vector/index_svwd01gd.html#9.35/55.9001/-4.184).

That said, the same lua code could be used for for both raster and vector tiles. In my case this is here.

One question you will want to ask yourself - where there is no name:gd, what name do you want to show? You might have a genuine reason to show no name at all (mapio.cymru does this), or you might want to show a name that is closer - I chose to show Irish, then Welsh, then English in the absence of Scots Gaelic.

3 Likes

Don’t do that! The far easier approach is to prefer name:gd at import time (in the Lua import script).

But as noted already, vector tiles are usually the simpler place to start these days.

1 Like

Apologies for OT but, I’d assumed “the code” here meant the lua import script :) . I don’t even think that osm2pgsql (for raster) or any equivalent for vector even does special-case name as a tag.

For raster “osm2pgsql” uses a file (confusingly called a “style file”) which determines which keys it should be interested in. This is different to the lua code (often called “style.lua”) which runs per data item in the imported data.

For vector “tilemaker” (just one of the options for creating vector tiles, but arguably the most approachable one) also uses lua code.

2 Likes

All I meant was that there isn’t some simple settings like an environment variable or similar where one can specify the language you want labels to use. You have to make some deeper level changes regardless of where exactly those are in “the code” (meant in a general sense as whatever part the overall code base it is necessary to change).

1 Like

Thank you all for your help! I decided to stay with openstreetmap-tile-server so that I’d have a ready-made Docker setup.

In the end, I manipulated the labels in the pbf file:

Then run:

osm-tags-transform/build/src/osm-tags-transform -c /path/to/backend/config.lua -o osm_maps/localized.osm.pbf osm_maps/merged.osm.pbf

I based the config.lua on osm-tags-transform/example-configs/carto-de.lua at master · osmcode/osm-tags-transform · GitHub but I put the localized labels first. I now have a nice bilingual map :star_struck:

3 Likes

The map is used at feuch - 1 feel! (test by feeling)... if you want to take a peek.