Rendering an audio map using OSM data - can lessons from graphical rendering help?

I have written a just-about-working audio atlas using OSM and Marine Border data. I can control my long/lat position with the cursor keys and get spoken feedback on the country/sea/ocean I am currently in.When I download all the admin_levels for a country I get spoken feedback on all the subdivisions. And I have a “What’s near me” feature which I can browse in order of either bearing or distance when I overlay data for, say, the cities in a country…

For example, I can go to somewhere in the UK and get the followinng announced:
Eastleigh,Hampshire,England,United Kingdom.
And that Southampton is 5 kilometres at a bearing of 135 degrees.
And if I go south 50 kilometres I end up in the English Channel.
All this is utterly fantastic because as a blind person I’ve not be able to get such detailed geographic info in many years.

I am struggling though with a number of aspects of rendering an audio map based on the data I have. I am guessing that the problems might well have been solved for graphical rendering.

Here are 3 examples for working out physical geography.

  • Terratorial waters are included in admin level boundary relations
    This makes it difficult to know when exactly a position is on land or on sea. How is this managed graphically?
    For example, when rendering a pixel just off the coast but within the terratorial waters of the main land, how can you know if you are on land or in water?

  • Mountain ranges
    Mountain ranges do not have polygons defining their area. Mountain ranges are made up of ridge lines and a node to position a label.
    A mountain node does not state the mountain range it is in so it is not possible to make a bounding box for all mountains of the same range.
    How are mountain ranges rendered graphically?
    The Himalayas are very long (as well as tall :slight_smile: ) so is it possible to work out when a point is in or out of this mountain range?

  • Deserts
    Very little info on deserts from what I have seen with a brief look.
    How are the extents of deserts rendered graphically?

So there is so much I don’t know that my assumptions might all be wrong and my lack of experience might be playing against me. However, I would very much like to know the general principles of rendering maps as well as specifics as above.

Some of the principles I’m thinking of are around coping with different zoom levels. Do I need to preprocess different versions of my data for different zoom levels? A global view is so different to manage compared to a 5km2 area. Do I need to do tiles? I think I’ll need an r*tree soon also.

Any help much appreciated.

In the default OSM rendering, land is beige-colored, and sea is colored blue. Out in the sea, there is a line through the blue which indicates the territorial waters. (Actually there are usually a couple lines representing different sorts of sea ownership boundaries that I’m not personally aware of the nuances of.)

I think you’re looking for natural=coastline, which really all I know about is that it works differently than just about everything else in OSM so hopefully someone else here can help describe it better.

I think that’s because mountain ranges kind of don’t have an “area”, in that there are some points that are clearly within it, and some far away points that clearly aren’t, but exactly where to draw a boundary would be very subjective as terrain just gradually becomes flatter as one gets further from a possible-also-subjective center. Many geographic things are like that. Exactly where an ocean begins and ends (and how many there are) is subjective, where someone could have reasonable criteria and others could use other criteria, but I don’t think any of them would really be meaningful down to the level of meters. Some settlements have similar fuzzy borders, with a clear central hub but just gradually sparser population as one gets further away and different people might consider one house a part of the same settlement and another person wouldn’t.

Now that you mention it, I don’t think any of the default OSM renderings on the home page specifically show mountain ranges. I’m guessing there are maps that do, though. Generally, I think these sorts of fuzzy-boundaries only show up on zoomed-out scales, with a text label overlaying the area as a whole, but just text and not any sort of borders.

Deserts similarly have fuzzy borders. I think that a map trying to show them would probably either be an aerial imagery (or satellite) map, with just letting the user see changes in vegetation that way, or would be a map presenting a specific definition like highlighting areas that get less than a certain amount of average rainfall per year. Or would just be zoomed out with text centered on the rough center of it, without a border shown.

There are certainly books and other resources on cartography, though I don’t know how accessible they would be to someone with sight challenges. I enjoyed reading “How to Lie with Maps” by Mark Monmonier, though it was more of a textbook than the humor book I was hoping for. ArcGIS/ESRI has an article posted about Blurry Borders that I’ve found. I’m just a random person who is finding looking at maps interesting, though, hopefully others here are actual experts or at least know of more resources.

Definitely one needs to think about the purposes of a map, and what information one is trying to portray, and those purposes are likely different for a world map than for a street map.

Hi Peter,
Thanks very much for your reply.
You said lots of things which are useful.
“default OSM rednering”. Is this what is meant by the map on www.openstreetmap.org?
So how does the rendering engine know to colour a pixel baige or blue? The rule might be that it isn’t in any admin_level relation. And actually, I’ve just realised as I wrote this that I could do a similar thing. At least, when I have admin_level data that isn’t including terratorial waters.
At the moment when I am moving around the atlas at scales of countries ie. Step sizes of 500 km or more, I don’t hold anything except admin_level=2 data. This comes back to my tiles and preprocessed data for different scales point.
"Out in the sea, there is a line through the blue ". That makes sense now.
Coastline ways don’t particularly help as they aren’t closed so I can’t apply the in-a-polygon test to see if I am inside or outside the polygon. Goes back to my question of how the default OSM render knows whether to make a pixel baige or blue.

Mountains.
I get the idea of fuzzy borders and that such things as you describe are subjective.
So does the defalt OSM renderer simply not give any indication of mountain ranges grahically?
If someone wants to get an idea of the extent of the Himalayas what would they get?
And deserts are very similar. The sahara is massive but does the OSM renderer just paint it baige?
When you said that a desert would be shown most likely as an aerial or satellite image this isn’t available as part of the OSM data.
You also said it could be drawn based on a rule like less than a certain amount of rain per year. Where could such data be obtained?
And I am also no expert. As you say, just someone finding all of this interesting.
Many thanks.

Yes. Though as I’m sure you’re aware, the underlying data is usable for many different maps, with different styles or focusing on different aspects. But the “Carto” map used when one just goes to openstreetmap.org is a general reference map showing a typical use of the data, yes.

I don’t think it has anything to do with admin levels, though maybe you’ll need an answer from people who have actually been involved with rendering. I think it’s just about looking at natural=water and natural=coastline.

Yes, I think you have to treat coastlines very differently in order to interpret them. I think in order to answer your question someone would need to look at the code of Carto or other renderers.

Correct, Other than “peak” symbols at zoom 11 and higher (triangles representing a peak of some sort), I don’t see any representation of mountains or mountain ranges. But the default view isn’t really focused on topographic details at all. If I switch to the “Tracestrack Topo” rendering, I see shaded terrain features (light and dark shading to indicate how the terrain raises and falls), with lower elevations in green, and higher elevations changing to orange, red, and grey giving an idea of the elevation. But no mountain or mountain range names at low zoom. Peaks are shown names at higher zooms, but I don’t see a concept of mountain ranges.

I think just the shaded terrain showing elevation.

Like I said, the main rendering isn’t really topographic. I don’t think it’s shown differently then other places. Maybe someone more familiar with the area can chime in, I found a node by searching but I don’t think any of the main maps show a label for it.

Yup. OSM tries to be about Verifiable data, but different maps for different audiences might need other sources.

That is a good question. I know things like Wikidata are trying to just store all the data about everything, and a lot of governments publish data through ArcGIS or their own GIS systems. Some systems designed for creating maps like Maptiler and Felt try to give you access to multiple data sources (I haven’t used either of them myself, though, and I’m sure there are others out there), and I don’t know how accessible they are to people with vision challenges.

Yeah, I do understand. I think you would find some books on cartography interesting. Making a map is a lot like making any kind of graph or chart: You want to do it with a goal in mind, and every choice you make, of including data, or excluding data, or the size of it, or whatever ends up impacting how people perceive it.

That sounds fascinating! Please keep us in the loop on how your project is going.

I’m not a map rendering expert but I do have some ideas for you.

Coastlines: you’re definitely looking for the natural=coastline tag. You can create land polygons by following natural=coastline ways until they form a closed loop, or just download the land polygons that have already been assembled from OSM data. Then you can query whether the coordinates you are looking at are within a land polygon or not.

Also, if you look for the nearest coastline way to a point, and then see which admin boundary the coastline belongs to, you should be able to output things like “you’re x miles off the coast of France”.

Mountain ranges:

Visually contour lines and hillshades are very important, so when I am looking at a mountain area on OpenStreetMap.org I always switch to a map renderer that shows them. With those you can immediately tell if you are looking at a gentle slope or a steep cliff face, and which mountain a slope belongs to. You can also see mountain ranges, though often they don’t have a distinct boundary visually, as in real life, it’s often not clear if that hilly area on the side would be considered part of it or not.

I suppose you could get a digital elevation model and see what you can do with that, e.g. you should be able to announce to the user what altitude the cursor is at and if the slope is gentle or steep and maybe things like what the peak above is called or the valley below (at high zoom).

Also, for a simpler approach, many natural=peak nodes have a Wikidata tag (example OSM node and Wikidata item) and then the Wikidata item for the mountain should have a property that tells you which mountain range it’s part of. Maybe if you start with all the peaks that Wikidata says are in the same mountain range, you can create a polygon from that?

1 Like

Land/sea has nothing to do with boundary relations, but is from the coastline shapefiles derived from OSM data. If you union these shapefiles with water polygons you can work out if you are within water, otherwise you are within land.

If you are making a map where this is important (e.g. a topo map) you need contour lines or hillshading, both of which come from a DEM which OSM does not provide since you can’t really crowd-source one.

Desert tagging is a mess. A desert is an area with little rainfall (e.g. Sahara or Antarctica) but tagging is not consistently applied.

1 Like

When you are ready to show something I would be very happy if I could to read about the tech and feel around how it works.

You are going to have to preprocess a lot to get this perfect. From my experience you having a tech demo, might mean that there will be better data in OSM in the end. There are some people who have started to map things as areas, but the support for that in the tech stack is not that great. So you might help with that.

Hi all.

I see how coastlines can be used now via the water polygons although the ones available for download are in Shapefile format which is a format I don’t know how to read currently. And I haven’t yet found an accessible mapping app I can use to convert them to something like XML. So for now I’m going to go for my compromise of using a higher level admin level polygon to tell me if I am on land or not. After all, I don’t think the coastline ways give any info on what the land is part of.

I was looking to create a node cluster of mountain peaks from Wikidata and use the Part Of Mountain Range property to determine the parent mountain range. I must be doing something wrong though as I am only getting a small number of peaks back for the Himalayas and Atlas ranges even when I look at sub-ranges. But I guess that is for a different forum.

It does look like there are some other online sources for mountain range boundaries -
https://www.nature.com/articles/s41597-022-01256-y
which are in Shapefile format - so perhaps I’ll put this in the to-do list for now.

I think I have more pressing problems like fitting a reasonable resolution world atlas into a manageable size.

Hopefully I can post a link to an audio demo in the near future.

Thanks.

1 Like