logo separator

[mkgmap-dev] Base style sub-styles

From Marko Mäkelä marko.makela at iki.fi on Thu Nov 24 19:51:10 GMT 2011

On Thu, Nov 24, 2011 at 08:00:24PM +0200, Bennie du Plessis wrote:
>Marko (mainly),
>
>How does the sub styles idea work.?
>
>In commit 1209, where is the sub-styles?

You mean r2109, right? It introduces the following styles under 
resources/styles:

landuse
waters
contours_ft

More is to come, as I get around to it. I am not sure if I am going to 
add all these, but this is the rough plan:

boundaries
leisure # most leisure/tourism things
rail-bus # public ground transportation
aero # airports, runways etc.
car # parking, fuel stations
restricted # military, prisons, etc.
manmade # building=*, man_made=*
commercial # shop=*, paid-for amenity etc.
services # public or non-commercial services
ways # all highway=*
pipes-cables

>at  \examples\styles I can see the default and noname styles.

Oh, it did not occur to me to look at dist/examples/styles. Right, it 
only contains a copy of the default and noname styles. I do not see 
anything obvious in dist/build.xml. Steve, any ideas how to include all 
styles there?

>In the info file of the default style I can see
>
>base-style=contours_ft
>base-style=location
>base-style=waters
>
>Is this the sub-styles that will be included in the default style?
>
>Where are these sub-styles though?

They are included in the dist/mkgmap.jar (which really is a zip archive 
with additional constraints). That is why it worked for me.

>Suppose an included base-style treats an element a certain way, will 
>the main style (default in this case) then ignore this element?

I did not think of that yet. My aim is to split the default style to 
disjoint substyles. Then, once that is done, one could easily create 
different kinds of "sparse" styles. One that I have in mind would import 
only highways and waters and maybe amenities and shops, but no landuse 
or buildings.

>So the base-style treatment overrides the main style?
>Will a continue statement in the base style then reverse this, so that 
>the main style treatment will prevail?

I was going to initially avoid the continue statement in the substyles.  
Currently, only the default style uses it, for internet_access=*. But I 
think it could be useful for boundary=*, in case a river or highway 
carries and additional boundary tag.

>I don't use the default style, but a style based on the default with a 
>couple of tweaks for custom points & lines etc.
>Still I like to keep updating regularly to benefit from Marko's 
>improvement in the style.
>So I copy my tweaks into the latest default styles manually.
>The sub style idea might make my manual operation unnecessary, if I can
>just include my own style into the default.
>Before any other included styles, if I understand it correctly.

Yes, my idea is to make it more modular, sort of building blocks that 
can be chosen and adapted. And I guess it would be desirable to allow 
the definitions in the base styles to be overridden, so that you would 
need to maintain only a small style that derives from the default style.

One thing that the base-style idea does not seem to currently cover is 
the deletion of rules. Say, you are otherwise satisfied with the default 
style, but you want to remove all rules for power=line. This is not 
currently possible, as far as I understand. Or maybe something like this 
would do:

power=line { delete power }

Unfortunately, this would unnecessarily bloat the tags-list of the 
parser. If the style contains no rules for any power=* tags, the parser 
can discard such tags immediately. Not so if you have the above 
power=line rule in the style.

Hopefully the TYP compiler and the substyles will invite people like you 
to contribute to mkgmap. Ideally, the substyles would be so flexible 
that users' custom styles would be very small, only a handful of 
base-style=* and some rules in points,lines,relations to augment, remove 
or change the built-in rules.

Best regards,

	Marko



More information about the mkgmap-dev mailing list