custom rendering: missing tags, general syntax

129 views
Skip to first unread message

grin

unread,
Jul 11, 2015, 6:53:47 AM7/11/15
to osm...@googlegroups.com
I am constantly wondering the weird and massively underdocumented syntax of custom rendering, and today I have yet again failed attempt to understand the logic behind it. Maybe someone could shed some light on it and if someone is able to make me understand I may try to write some documentation about it. 

Today I have tried to create a rendering style to debug the map: show residentials with no name, show fixme tags, etc.

Again I had to realise that this XML isn't your everyday XML, for example the "documentation" suggested me that these are equivalent:

<line>
<switch>
 <switch tag="highway" value="residential">
  <case tag="name" value="">
   <apply  color="#e0ff0000" strokeWidth=":2"/>
  </case> 
 </switch>
</switch>
</line>

<line>
<switch>
 <switch tag="highway" value="residential">
  <case tag="name" value=""/>
  <apply  color="#e0ff0000" strokeWidth=":2"/>
 </switch>
</switch>
</line>

They apparently aren't: one changes every residential and the other changes none. I have tried to figure out when to use switch or case, when to put changed parameters as attributes or in separate apply tags, why to have an empty toplevel switch tag etc but I get really random results.

Apart from that I seem to be unable to define a case where it would tag highway=residential without name tags (or the other way around with name tags of any value, though this isn't what I need).

(As for testing I have seem to have lost the way to exit OsmAnd, and it seems not realoading once loaded style so I have to ask android to KILL osmand to be able to test the next change of rendering style. :-/)

Anyone have an idea how to render residentials with missing name tags red?

stf

unread,
Jul 11, 2015, 12:20:16 PM7/11/15
to osm...@googlegroups.com
I can't help much on the actual rendering, but if you set this up as a new xxx.render.xml file you might be able to get it to reload by changing the rendering from the default to yours and then back again. That might speed up your experimental process.

I see a bunch of stuff in my favorite rendering XML file that uses groupFilter to set variations on how things look. Maybe that would be a way of changing the color if the name="".

grin

unread,
Jul 11, 2015, 2:08:58 PM7/11/15
to osm...@googlegroups.com
On Saturday, July 11, 2015 at 6:20:16 PM UTC+2, stf wrote:
I can't help much on the actual rendering, but if you set this up as a new xxx.render.xml file you might be able to get it to reload by changing the rendering from the default to yours and then back again. That might speed up your experimental process.

Unfortunately it isn't always the case: it seems that when the XML isn't liked by OsmAnd it doesn't get loaded again no matter the change. I'll check whether it really reloads when changing back and forth.
 
I see a bunch of stuff in my favorite rendering XML file that uses groupFilter to set variations on how things look. Maybe that would be a way of changing the color if the name="".

groups and filters "are the oldskool way", they were replaced by switches and cases, but to be honest it didn't quite get clearer. :-) 

g

stf

unread,
Jul 11, 2015, 8:03:20 PM7/11/15
to osm...@googlegroups.com
Hmmm. I hadn't taken a look at the default.render.xml file recently. I guess I need to recode my personal rendering style to use the new conventions.

And while trying, unsuccessfully, to come up with a solution to your very reasonable question I find that just changing rendering styles is not enough to force Osmand to re-read the rendering directory. What a PITA that they removed the exit button, have to force stop it all the time to do any checking.

I suspect that tagName="name" is not being acted on because the name tags are perhaps specially handled and aren't available while rendering lines. But I haven't checked any source code to confirm or contradict that suspicion.

xmd5a

unread,
Jul 24, 2015, 7:56:54 AM7/24/15
to Osmand, gri...@gmail.com
tag="name" will not work because it is stored another way. To filter tag by name you should use nameTag="" but it is used only in <text> section. I do not see a way to do what you need without modifying data stored in obf with entity_convert (see resources/obf_creation/rendering_types.xml). I agree that rendering styles xml is hard to understand.
For debugging purposes I suggest you to use OsmAnd MapCreator with offline rendering. Unfortunately it works only in Linux x64 but it is a much faster way to test style. You can use VirtualBox or something else if you do not have PC running Linux x64.

суббота, 11 июля 2015 г., 13:53:47 UTC+3 пользователь grin написал:
Reply all
Reply to author
Forward
0 new messages