Custom interval for contourlines

121 views
Skip to first unread message

mika.va...@gmail.com

unread,
Jul 9, 2020, 2:53:18 PM7/9/20
to OsmAnd
So i live in the Netherlands, and the landscape is pretty flat here. However we still have some small relief in the landscape. Most of these little hills are no more then 20m but they can be pretty steep. Therefore i would like to have contour lines to better estimate the terrain. However, the standard contour lines in Osmand only come in three set intervals, Low, medium and high. I beleive the high setting displays the contour lines at 5m, but this is still not enough. Is there a way to get these contour lines to display at a custom interval, like 1m? is this maybe possible by editing the rendering file? i would love to hear back from you guys!

A Thompson

unread,
Jul 9, 2020, 9:21:06 PM7/9/20
to OsmAnd
Hi! I'm no expert, but have experimented with this sort of thing. As far as I know:

OsmAnd's elevation data comes from the NASA SRTM/ASTER data that is available freely for the whole world except towards the poles. This has a horizontal resolution of 1 arc-second, about 30 metres. The vertical accuracy varies but seems to be no better than +/-5m. So it doesn't make sense to have contour line spacing too close.

OsmAnd's contour lines are pre-computed in the download, rather than being generated dynamically on your device from raw elevation data, so you can't try closer spacing just by tweaking the rendering styles.

Many countries are providing open access to more accurate DTM/DEM data from LIDAR surveys. In the UK we have this only for flood modelling, which if one's interested in hills is the opposite of what one wants! LIDAR data can be amazingly accurate, e.g. you can see the shape of a car. If you have such data, you can generate your own contour lines in QGIS and get them to show in OsmAnd. If you're interested I could post some notes I made when I tried it, but it requires a little dedication. I found that I could now see features such as cliffs and quarries that had not been marked as such on OSM, but for me it wasn't worth the large file sizes of what I had generated. That was three years ago when OsmAnd's minimum spacing was 10m - I hadn't noticed that the "high" setting now gives 5m. This shows my missing quarries, but must be the limit for SRTM data. (Unless OsmAnd is now tapping in to LIDAR? I can't find any information on that.)

Just google any of the terms I used if you're not familiar! I hope that's of interest.

A Thompson

unread,
Jul 9, 2020, 9:45:08 PM7/9/20
to OsmAnd
Reply to self...

I saw reference to 5m contours in the default rendering file, but in the UK I don't see them on the map with the "high" setting, no matter how far I zoom in. I was already wondering how they would make sense if the accuracy is +/- 5m. The improvement in quarries I thought I saw was either placebo or improved 10m contours.

If anyone knows about OsmAnd's current status and plans, I'd love to hear from someone who knows what they're talking about!

Mika Van de wiel

unread,
Jul 10, 2020, 5:12:05 AM7/10/20
to OsmAnd
Hmm, that would be awesome! we in holland got free hightmaps, but i believe you can only download them in a few formats. if you could send me the tutorial on how to do it in qgis and your nodes I think i can try it!

Op vrijdag 10 juli 2020 03:21:06 UTC+2 schreef A Thompson:

Mika Van de wiel

unread,
Jul 10, 2020, 7:45:14 AM7/10/20
to OsmAnd
I have now gotten it to work in qgis, however, how can I best export it for Osmand? I do have Mapc2mapc, but i cannot find any good formats to export it as.

Op vrijdag 10 juli 2020 11:12:05 UTC+2 schreef Mika Van de wiel:

A Thompson

unread,
Jul 10, 2020, 1:24:32 PM7/10/20
to OsmAnd
In QGIS I followed the tutorials:
and
but note that QGIS is constantly evolving. It's possible to run old versions alongside the latest one, which can sometimes be useful.
  • Raster>Extraction>Contour and make sure the output file has a .shp extension (ESRI shapefile). Yes to add elevation attribute ELEV.
  • Right-click on the resulting contour layer and "Save as…" another shapefile with the CRS changed to WGS84
Next I used JOSM to convert to .osm and along the way adjusting the contour tags to be what OsmAndMapCreator expects. I found an example of what SRTM2OSM produces. It looks like this:

<way>

...

<nd ref="3000003337"/>

<nd ref="3000003338"/>

<tag k="elevation" v="1390"/>

<tag k="contour" v="elevation"/>

<tag k="contourtype" v="10m"/></way>

 

<way>

...

<nd ref="3004927551" />

<nd ref="3004927552" />

<tag k="elevation" v="2300" />

<tag k="contour" v="elevation" />

<tag k="contourtype" v="100m" />

<tag k="name" v="2300" />

</way>


So using JOSM with the opendata plugin, I loaded the shapefile, hit CRTL-A to select all and changed all tag keys "ELEV" to "elevation" and "ID" to "ref". Then I added the new tag key=contour value=elevation to them all. I think OsmAnd's renderers also now require the "contourtype" tag - I would try giving it the value 10m even if that's incorrect, to make sure the renderers expect it.

The save as .osm and use OsmAndMapCreator, File>Create .obf from .osm file. This generates an  .obf  that you can just copy into your main OsmAnd directory - you should see the new contours in addition to any that you already have.

All of these programs have changed in the 3 years since I did this! But I hope this gives you a way in.
Reply all
Reply to author
Forward
0 new messages