Name caption not shown

70 views
Skip to first unread message

Olivier Croquette

unread,
Mar 19, 2013, 6:16:16 PM3/19/13
to mapsfo...@googlegroups.com
Hi,

I use a custom render theme and also a custom tag-mapping.xml to display custom tags of mine.

My OSM nodes look like:

<node id='999935201967'>
<tag k='name' v='Fasangarten' />
<tag k='station_type' v='sbahn' />
</node>

Here is the relevant rule in the render theme:

<rule e="node" k="station_type" v="ubahn" zoom-min="15">
<symbol src="jar:symbols/ubahn.png" />
<caption k="name" font-style="bold" font-size="13" fill="#2d2dec" stroke="#ffffff" stroke-width="2.0" />
</rule>

The symbol is displayed, but not the caption.
I checked the original OSM file, which definitely contains the name's.

Any idea why the caption would not be displayed ?

I also tried to set the following caption:
<caption k="station_type" font-style="bold" font-size="13" fill="#2d2dec" stroke="#ffffff" stroke-width="2.0" />

It fails with an IllegalArgumentException.
A quick look to the samples and source code gives me the impression that only certain tags are supported in a caption. Is that correct ?

Thanks !

Regards

Olivier

Thilo Mühlberg

unread,
Mar 20, 2013, 3:40:42 AM3/20/13
to mapsfo...@googlegroups.com
Hi Oliver,

our current binary map format allows only for a very few free-text tags
like "name" and "addr:housenumber". If your node has other free text
tags like "foo=bar" they will not be written to the map file and thus
will not be rendered even if you declare them in your render-theme file.

The reason why your caption is not shown might be a bug in the current
labeling algorithm which is completely undocumented, untested and known
to be buggy. Reimplementing that from scratch is on our todo list.

Try to remove the symbol and just specify the caption. Maybe the symbol
is "in the way" and you will be able to see the caption if you remove
the symbol. Then at least you know that the node and its name is
correctly included in your map file and that your caption rule is ok.

Greetings,
Thilo
signature.asc

Olivier Croquette

unread,
Mar 20, 2013, 5:02:45 PM3/20/13
to mapsfo...@googlegroups.com
Hi Thilo,

thank you for the quick feedback !

You are right. If I do:

<rule e="node" k="station_type" v="ubahn" zoom-min="15">
<symbol src="jar:symbols/ubahn.png" />
</rule>

Then I can see the symbol.
If I do :

<rule e="node" k="station_type" v="ubahn" zoom-min="15">
<caption k="name" font-style="bold" font-size="13" fill="#2d2dec" stroke="#ffffff" stroke-width="2.0" />
</rule>

Then I see the caption.

If I have both, I see only the symbol.

I tried to have 2 separate rules, one for the symbol and one for the caption, but it looks like the rendering engine takes randomly one or the other, but never both.

I have also tried to duplicate my nodes:

<node lat='48.1490234' lon='11.44403'>
<tag k='name' v='Westkreuz' />
<tag k='station_type' v='sbahn' />
</node>

<node lat='48.1490234' lon='11.44403'>
<tag k='name' v='Westkreuz' />
<tag k='station_name' v='yes' />
</node>

and then render them this way:

<rule e="node" k="station_name" v="yes" zoom-min="15">
<caption k="name" font-style="bold" font-size="13" fill="#2d2dec" stroke="#ffffff" stroke-width="2.0" />
</rule>
<rule e="node" k="station_type" v="ubahn" zoom-min="15">
<symbol src="jar:symbols/ubahn.png" />
</rule>

But the captions are never shown either. Is there a limitation ?

Best regards

Olivier

Thilo Mühlberg

unread,
Mar 20, 2013, 6:10:25 PM3/20/13
to mapsfo...@googlegroups.com
I am not surprised that duplicating the node and splitting the rules
doesn't solve the problem. It is caused by a "limitation" (you might
also call it "bug") in the current labeling algorithm and
implementation. As i already said, it is known to be buggy and we need
to rewrite it from scratch in order to overcome such limitations.

Greetings,
Thilo
signature.asc

emux

unread,
Mar 21, 2013, 3:26:49 AM3/21/13
to mapsfo...@googlegroups.com
Hi Oliver,

You may have to look at caption's "dy" property in order to show both symbol and caption at the same time.
You can see examples of its use at the osmarender.xml
http://code.google.com/p/mapsforge/source/browse/mapsforge-render-theme/src/main/resources/osmarender/osmarender.xml
There are both negative and positive positionings of caption relative to symbol.

Greetings

Olivier Croquette

unread,
Mar 22, 2013, 7:40:06 PM3/22/13
to mapsfo...@googlegroups.com
On Mar 21, 2013, at 8:26 AM, emux wrote:
> You may have to look at caption's "dy" property in order to show both symbol and caption at the same time.

Thanks for your help ! However my problem is not that the items hide each other, but rather that either one or the other is displayed.


Reply all
Reply to author
Forward
0 new messages