[VTM] Hiking render-theme

110 views
Skip to first unread message

Adi Barda

unread,
Jul 4, 2018, 10:55:28 AM7/4/18
to mapsforge-dev
Hello Everyone,
I have decided to try creating an Hiking render-theme file for my mobile app. it is located in GitHub:
https://github.com/adibarda/VTM-hiking-render-theme/tree/master

The target is creating a native VTM hiking render theme. 
So far i have added contour lines (Thanks Emux)
Next I'm going to deal with the hiking routes and I'm using the below XML as a start:
My biggest challenge is finding proper documentation for the OpenAndroMaps such as the category tag "h_routes", the values "lwn","uwn" etc. 
If anyone has links for any kind of docs - I'll be glad to get them
Also - can anyone explain how to use the "strokeDasharray"? I would like to mark some of the hiking routes with Dash pattern.

Thanks!

<m cat="h_routes"   >
<m e="way"   closed="no" zoom-min="14">
<m e="way" k="highway" v="tertiary|secondary|primary|tertiary_link|secondary_link|primary_link|construction|road|unclassified|residential|living_street|ford|pedestrian|track|byway|service|cycleway">
<m    zoom-max="16">
<m e="way" k="hknetwork" v="lwn|uwn">
<line stroke="#E0F0FF00" width="1.9"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="rwn">
<line stroke="#A000FF50" width="1.9"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="nwn">
<line stroke="#90FF4080" width="1.9"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="iwn">
<line stroke="#702060FF" width="1.9"  cap="butt" />
</m>
</m>
<m    zoom-min="17">
<m e="way" k="hknetwork" v="lwn|uwn">
<line stroke="#E0F0FF00" width="0.6"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="rwn">
<line stroke="#A000FF50" width="0.6"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="nwn">
<line stroke="#90FF4080" width="0.6"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="iwn">
<line stroke="#702060FF" width="0.6"  cap="butt" />
</m>
</m>
</m>
<m e="way" k="highway" v="footway|path|steps|bridleway|via_ferrata">
<m    zoom-max="16">
<m e="way" k="hknetwork" v="lwn|uwn">
<line stroke="#E0F0FF00" width="0.9"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="rwn">
<line stroke="#A000FF50" width="0.9"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="nwn">
<line stroke="#90FF4080" width="0.9"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="iwn">
<line stroke="#702060FF" width="0.9"  cap="butt" />
</m>
</m>
<m    zoom-min="17">
<m e="way" k="hknetwork" v="lwn|uwn">
<line stroke="#E0F0FF00" width="0.6" dy="-0.6"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="rwn">
<line stroke="#A000FF50" width="0.6" dy="-0.6"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="nwn">
<line stroke="#90FF4080" width="0.6" dy="-0.6"  cap="butt" />
</m>
<m e="way" k="hknetwork" v="iwn">
<line stroke="#702060FF" width="0.6" dy="-0.6"  cap="butt" />
</m>
</m>
</m>
</m>

Emux

unread,
Jul 4, 2018, 11:02:15 AM7/4/18
to mapsfo...@googlegroups.com
Can check Elevate theme for the map key details if can help?

VTM (+ Mapsforge) theme syntax and semantics are similar to Osmarender rules.
Can check also there for detailed descriptions of the various rules.

--
Emux

Adi Barda

unread,
Jul 4, 2018, 11:46:28 AM7/4/18
to mapsforge-dev
Any idea how to apply the dash pattern only on the outline of the route?
I saw there is an "outline" attribute in the XSD but it can have free text (string) and not some kind of pre defined enum.
So what are the options for the "outline" attribute?
I need that the inner (fill color) color will be transparent and to have a dash pattern in the outline

Thanks

Emux

unread,
Jul 4, 2018, 11:54:47 AM7/4/18
to mapsfo...@googlegroups.com
Could be like the roads are rendered, with two line rules, wide casings below and narrow cores on top.

--
Emux

Adi Barda

unread,
Jul 5, 2018, 7:17:14 AM7/5/18
to mapsforge-dev
This did the trick for me but the dash pattern is not so smooth (see attached pic) - see code below:
I wonder if that's what you meant when suggesting to use 2 lines?
Thanks!


<m e="way"   closed="no" zoom-min="14">
<m e="way" k="highway" v="tertiary|secondary|primary|tertiary_link|secondary_link|primary_link|construction|road|unclassified|residential|living_street|ford|pedestrian|track|byway|service|cycleway">
<m    zoom-max="16">
<m e="way" k="hknetwork" v="lwn|uwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
<m e="way" k="hknetwork" v="rwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
<m e="way" k="hknetwork" v="nwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
<m e="way" k="hknetwork" v="iwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
</m>
<m    zoom-min="17">
<m e="way" k="hknetwork" v="lwn|uwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
<m e="way" k="hknetwork" v="rwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
                        
</m>
<m e="way" k="hknetwork" v="nwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
<m e="way" k="hknetwork" v="iwn">
<line stroke="#FF000000" width="1.2"  cap="butt" dasharray="15,5" />
                        <line stroke="#FFFFFFFF" width="1"  cap="butt"  />
</m>
</m>
</m>

Emux

unread,
Jul 5, 2018, 7:22:12 AM7/5/18
to mapsfo...@googlegroups.com
Can study how the roads are declared in theme, in two stages, casings + cores.

--
Emux

Adi Barda

unread,
Jul 5, 2018, 9:44:05 AM7/5/18
to mapsforge-dev
I'm doing my best not to ask too many questions but I'm kind of stuck here :)
I've searched everywhere in the osmarender.xml which is my base render-theme and don't really find the place where roads are declared.
I appreciate if you point me to line number or code snippet.

I also tried to create a new outline layer with dasharray:
<outline-layer cap="butt" id="casing-hiking" stroke="#404040" dasharray="5,5" width="0.25" />

But it looks like dasharray is not supported in the outline layer... it doesn't render at all when having the dasharray attribute in it.

My last option will be to try extending the Java class which is responsible for the rendering but I don't want to get there yet.. :)

Emux

unread,
Jul 5, 2018, 11:47:45 AM7/5/18
to mapsfo...@googlegroups.com
If check OSM tags to see that usually the "highway" tag is for roads and search that word will find more than many results. :)

Again if want to debug one map element, use a theme with only that rule in a map area that contains it, for easier testing.

Regarding rendering, things are not so simple like Mapsforge which has simple (only) Java rendering.
VTM rendering involves OpenGL which work differently and some things are not efficient to have.

So outlines cannot have textures or stipples (i.e. dash arrays) as mentioned in #146.
That can work with casings+cores method as appears in highways.

--
Emux

Emux

unread,
Jul 5, 2018, 12:06:42 PM7/5/18
to mapsfo...@googlegroups.com
Another rule that works differently in OpenGL and so has different implementation in VTM themes is area style stroke width.

The explanation is provided by Hannes in #121.

--
Emux

Adi Barda

unread,
Jul 8, 2018, 9:27:35 AM7/8/18
to mapsforge-dev
Hi,
Some strange behavior with outline casing:
I set min zoom to 12 and max zoom to 20 (see code below) and for some reason in zoom levels only partial outline is rendered (see attached pic for sample in zoom 15 and 16)
What might be the issue?


Thanks,
Adi

<m e="way" closed="no" zoom-min="12">
<m e="way" k="highway" v="tertiary|secondary|primary|tertiary_link|secondary_link|primary_link|construction|road|unclassified|residential|living_street|ford|pedestrian|track|byway|service|cycleway">
<m zoom-max="20">
<m e="way" k="hknetwork" v="lwn|uwn|rwn|nwn|iwn">
<line use="hiking" outline="casing-hiking"/>
                        
</m>
</m>
</m>
</m> 
theme_sample1.png
Reply all
Reply to author
Forward
0 new messages