Tagged: mapsforge
- AuthorPosts
- February 23, 2019 at 07:45 #27195AnonymousInactive
Hi,
first sorry for originally posting this message in the German section, but I then realised that there is this English section of the forum, so I moved my message here.
Hoping that one day I’ll be able to create a fork of OpenAndroMaps for winter sports (see Elevate Winter Fork), I’m trying to create a very small map for testing purposes. My goal is to learn and understand how OpenAndroMaps .map files (e.g. Alps_West.map) are created. I understand that the actual rendering of any such map depends also on the rendertheme file (e.g. Elevate.xml), however in this first phase I’d like to figure out how a map file is built starting from raw OpenStreetMap data.
Here are the steps I performed:
1. Downloaded a small amount of OSM data from a known area with JOSM (file sauze.osm)
2. Used the tag-transform rules published on this site (pasted in a file called transform.xml) to get a transformed version of original OSM data. The command I used for this was:
$ osmosis --read-xml file=sauze.osm --tag-transform file=transform.xml --write-xml file=sauze.trs.osm
3. Checked that generated file sauze.trs.osm has some new tags that were unavailable in the original sauze.osm file–e.g. the new file has the mtb_scale tag.
4. Used mapfile-writer plugin for Osmosis to get a mapsforge map file:
$ osmosis --read-xml file=sauze.trs.osm --mapfile-writer file=sauze.trs.map
At this point I would expect that the sauze.trs.map file had the information needed for the Elevate rendertheme. However, if I set for instance the MTB style, I don’t see paths coloured according to their MTB scale difficulty.
What am I missing? Something big I assume…
Thanks & Regards!
February 23, 2019 at 12:31 #27207ChristianKKeymasterYou cant see the MTB-Routes cause Mapsforge-writer can’t resolve Relations.
This is be done by my own scripts in Perl.
The published TagTransform and TagMapping is for Theme-Devellopers and not a howto for making maps.
This is (if you want to have all feaatures of OAM) a very complicated prozess over dozends of steps involving many tools (all free but some more than less modified) and in constant development cause mapping in OSM is changing with every month.Oups..
$ osmosis –read-xml file=sauze.trs.osm –mapfile-writer file=sauze.trs.mapyou have to include a tagmapping file:
$ osmosis –read-xml file=sauze.trs.osm –mapfile-writer file=sauze.trs.map tag-conf-file=tag-mapping.xmltagmapping you can find here:
https://www.openandromaps.org/map-basics-2/tag-mappingBest regards
Christian1 user thanked author for this post.
February 23, 2019 at 20:26 #27209AnonymousInactiveThank you very much. Actually I’m not interested so much with relations at the moment—it’s a further layer of complexity that I can’t cope with for the time being.
My issue was with more basic features, like the colouring of paths based on mtb:scale. But I believe that your hint on tag-mapping will solve it. I’ll test it and let you know.
Thanks again
February 24, 2019 at 21:24 #27219AnonymousInactiveyou have to include a tagmapping file:
$ osmosis –read-xml file=sauze.trs.osm –mapfile-writer file=sauze.trs.map tag-conf-file=tag-mapping.xml
tagmapping you can find here:
https://www.openandromaps.org/map-basics-2/tag-mappingOk, it worked! Thanks again for the hint!
Next step is integrating contour lines, but for the time being I’m happy 🙂
1 user thanked author for this post.
February 25, 2019 at 11:45 #27223ChristianKKeymasterNext step is integrating contour lines
phyghtmap is your friend
http://katze.tfiu.de/projects/phyghtmap/phyghtmap.1.html1 user thanked author for this post.
February 26, 2019 at 06:43 #27238AnonymousInactiveThank you, man! Here’s the point where I’ve arrived, and the commands I used (file sauze.osm was exported from JOSM):
(edm)bash-3.2$ phyghtmap -a 6.8375554:44.9932994:6.9037348:45.0400038 --earthexplorer-user solitone --earthexplorer-password bayou.Rename9 --source=srtm1 -o sauze --max-nodes-per-tile=0 --write-timestamp bash$ osmosis --rx sauze.osm --rx sauze_lon6.84_6.90lat44.99_45.04_srtm1v3.0.osm --merge --wx sauze_contours.osm bash$ osmosis --read-xml file=sauze_contours.osm --tag-transform file=transform.xml --write-xml file=sauze_contours.trs.osm bash$ osmosis --read-xml file=sauze_contours.trs.osm --mapfile-writer file=sauze_contours.trs.map tag-conf-file=tag-mapping.xml
Are the tag-transform.xml and tag-mapping.xml files on the MapBasics section up to date? My map does not show elevation labels, unless I zoom in a lot. Standard OpenAndroMaps show elevation labels also with much lower zoom levels. Besides, some other captions are missing (e.g. the caption for lake Lago Nero, compare the two pictures below).
February 28, 2019 at 12:23 #27297ChristianKKeymasterBesides, some other captions are missing (e.g. the caption for lake Lago Nero
You are right.
I use my own labels.
= the area of lakes, reservoirs, etc.. is calculated, a poly_weight tag (value depends on area covered), the center of the lake(..) is calculated and a “poly_label” is set (node).
There are a lot of such optimizations (like housnumbers derived from buildings tagged as relations), aso.The batch file for creating a map is 507 lines long, not included prozessing of land/sea and pois.
However, this is fine_tunning, the core information is served by the script you created.1 user thanked author for this post.
February 28, 2019 at 20:39 #27367AnonymousInactiveThat’s a mystery–I’ve recreated my small map using the new tag-transform and tag-mapping files:
$ osmosis --read-xml file=sauze_contours.osm --tag-transform file=tt_andromaps.xml --write-xml file=sauze_contours.trs.osm $ osmosis --read-xml file=sauze_contours.trs.osm --mapfile-writer file=sauze_contours.trs.map tag-conf-file=tagmapping-urban.xml
However elevation labels are shown only for zoom level >= 17. In contrast, with a standard OpenAndroMaps elevation labels are shown for zoom level >= 15. I’m confused!
February 28, 2019 at 22:00 #27379TobiasKeymasterHowever elevation labels are shown only for zoom level >= 17. In contrast, with a standard OpenAndroMaps elevation labels are shown for zoom level >= 15. I’m confused!
Probably your contours are more rounded. For pathtext a straight segment long enough to render the text is needed, this is an old issue in mapsforge:
https://github.com/mapsforge/mapsforge/issues/885Developer of Elevate mapstyle
1 user thanked author for this post.
March 1, 2019 at 06:31 #27387AnonymousInactiveProbably your contours are more rounded. For pathtext a straight segment long enough to render the text is needed, this is an old issue in mapsforge.
Is it possible that my contours are more rounded because I used SRTM elevation data, in contrast to OpenAndroMaps that use @sonny’s LaserElevationData, as pointed out here?
March 1, 2019 at 07:17 #27392TobiasKeymasterNo, probably not as those are more detailed. But as far as I know they are simplified in the process to take up less space in the map file, Christian can tell you how (I think it’s also in the thread for Sonny’s DEMs).
Developer of Elevate mapstyle
March 1, 2019 at 10:54 #27398ChristianKKeymasterContourlines are simplified by “simplify-ways” an Osmosis Plugin.
However, it needs a very old version of Osmosis.If you have troubles downloading the plugin I can provide a running Osmosis configuration.
1 user thanked author for this post.
March 1, 2019 at 11:43 #27404AnonymousInactiveOk, I’ll check that, thanks!
March 7, 2019 at 16:07 #27435AnonymousInactiveOK, thanks to simplify-ways (well, indeed to ChristianK 😉 ) now contour labels do show up:
@ChristianK, just a curiosity–what epsilonMeters value are you using for simplify-ways? I tried with 10 meters.
Here are all the commands I ran to get to this point:
(edm)bash-3.2$ phyghtmap -a 6.8375554:44.9932994:6.9037348:45.0400038 --earthexplorer-user solitone --earthexplorer-password <PWD> --source=srtm1 -o sauze --max-nodes-per-tile=0 --write-timestamp bash$ ~/opt/osmosis-0.39/bin/osmosis --read-xml sauze_lon6.84_6.90lat44.99_45.04_srtm1v3.0.osm --simplify-ways epsilonMeters=10 --wx sauze_lon6.84_6.90lat44.99_45.04_srtm1v3.0_simpld.osm bash$ osmosis --rx sauze.osm --rx sauze_lon6.84_6.90lat44.99_45.04_srtm1v3.0_simpld.osm --merge --wx sauze_contours_simpld.osm bash$ osmosis --read-xml file=sauze_contours_simpld.osm --tag-transform file=tt_andromaps.xml --write-xml file=sauze_contours_simpld.trs.osm solitone$ osmosis --read-xml file=sauze_contours_simpld.trs.osm --mapfile-writer file=sauze_contours_simpld.trs.map tag-conf-file=tagmapping-urban.xml
Plugin simplify-ways works only with osmosis version 0.39 (not with current 0.47, which you need for plugin maple-writer BTW, so you need both versions). I had to manually add bounding box info in the simplified contourline file sauze_lon6.84_6.90lat44.99_45.04_srtm1v3.0_simpld.osm:
<bounds minlat="44.9932994" minlon="6.8375554" maxlat="45.0400038" maxlon="6.9037348"/>
March 10, 2019 at 07:32 #27486ChristianKKeymasterI use epsilonMeters=3
BTW: You are showing up here as “Anonym” – have you deleted your Account?
- AuthorPosts
- You must be logged in to reply to this topic.