
Hi In the style-include branch (pre-built jar files available at http://www.mkgmap.org.uk/snapshots/) you can now include files from the same style. The syntax is: include "filename"; You can put this anywhere where you can start a new rule. The contents of the file "filename" are included at that point in the file, just as you would expect. You can (and probably should) put the files in a subdirectory and access it as: include "inc/filename"; A forward slash should be used, even on windows (untested - will fix if it doesn't work). You don't strictly need the quotes around the filename if it is only letters, but its best to always use them since common filename characters such as '.' and '/' will require the quotes anyway. An included file can include another file and this can be arbitrarily nested. The name of the file is always relative to the top of the style and not relative to the location of the file that includes it. So if you have a sub-directory 'inc' with files 'first' and 'second' and 'inc/first' wants to include 'second' then it is written as: include "inc/second"; and not: include "second"; You can't yet include files from other styles, maybe that is not really so useful, what do you think? ..Steve

Hi Steve, thanks! I've made a basic test and it worked fine for me. I think it would be nice to be able to include files from other styles. One example are the rules for address tagging to set the mkgmap:country etc. tags. They are required in each style that should create indexed maps. WanMil
Hi
In the style-include branch (pre-built jar files available at http://www.mkgmap.org.uk/snapshots/) you can now include files from the same style.
The syntax is:
include "filename";
You can put this anywhere where you can start a new rule. The contents of the file "filename" are included at that point in the file, just as you would expect.
You can (and probably should) put the files in a subdirectory and access it as:
include "inc/filename";
A forward slash should be used, even on windows (untested - will fix if it doesn't work).
You don't strictly need the quotes around the filename if it is only letters, but its best to always use them since common filename characters such as '.' and '/' will require the quotes anyway.
An included file can include another file and this can be arbitrarily nested. The name of the file is always relative to the top of the style and not relative to the location of the file that includes it. So if you have a sub-directory 'inc' with files 'first' and 'second' and 'inc/first' wants to include 'second' then it is written as: include "inc/second"; and not: include "second";
You can't yet include files from other styles, maybe that is not really so useful, what do you think?
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On Fri, Aug 31, 2012 at 07:06:48PM +0200, WanMil wrote:
I think it would be nice to be able to include files from other styles. One example are the rules for address tagging to set the mkgmap:country etc. tags. They are required in each style that should create indexed maps.
I agree. Last year, I wanted to divide the default style into modules. It would be easier to continue this with the style-include branch. Perhaps there could be a 'standard library' of files that all styles (including user-defined styles) could include? Marko

Hi
Last year, I wanted to divide the default style into modules. It would be easier to continue this with the style-include branch. Perhaps there could be a 'standard library' of files that all styles (including user-defined styles) could include?
A library is a good idea. I don't think that including from other styles is a bad idea, the question is just how do we do it. If you are developing your own style then you can divide it up into as many different files that you like and place them all somewhere inside the style. You might want to include a file from one of the built in styles but then you would be relying on it not changing too much in an incompatible way. Having a library of style fragments as a built in style might go a long way to make that more manageable. So I'll ask another question: if there was a syntax include some-file from some-style should the some-style be restricted to a library or any built in style? I am worried that --style-file and --style arguments already cause some confusion. ..Steve

Hi I think about something like include "default_address_search" and other basic elements. To include parts of other styles could be pretty hard, because some parts aren't really stand alone because of requirements. Eg. copying name from route-relation to a normal way. One style copy name-Tag to bicycle_name another style to xyz and so on. So there is no really difference between change existing code to your needs and include code from someone else or just changing the code an copying the code directly to your style. Henning Am 05.09.2012 16:06, schrieb Steve Ratcliffe:
Hi
Last year, I wanted to divide the default style into modules. It would be easier to continue this with the style-include branch. Perhaps there could be a 'standard library' of files that all styles (including user-defined styles) could include? A library is a good idea.
I don't think that including from other styles is a bad idea, the question is just how do we do it.
If you are developing your own style then you can divide it up into as many different files that you like and place them all somewhere inside the style.
You might want to include a file from one of the built in styles but then you would be relying on it not changing too much in an incompatible way. Having a library of style fragments as a built in style might go a long way to make that more manageable.
So I'll ask another question: if there was a syntax
include some-file from some-style
should the some-style be restricted to a library or any built in style? I am worried that --style-file and --style arguments already cause some confusion.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

I "would need" or think it's easiest if there would be two things: a) include_section_XYZ from file_XYZ and b) include_file_XYZ So you could decide to either include a file containing several sections (so you can have section XY1 section XY2 and so on, for one layout, and section XX1 XX2 for another layout) or include the full content from a file. In any case, I think naming the relative path of the file should be best. Copying in stuff directly from the mkgmap.jar inbuilt styles, might cause too much errors. You could still copy in stuff from mkgmap inbuilt style, by pointing the file pointer to an mkgmap svn repository directory. --style-file and --style do cause confusion to many people I think. On 05.09.2012 16:06, Steve Ratcliffe wrote:
Hi
Last year, I wanted to divide the default style into modules. It would be easier to continue this with the style-include branch. Perhaps there could be a 'standard library' of files that all styles (including user-defined styles) could include? A library is a good idea.
I don't think that including from other styles is a bad idea, the question is just how do we do it.
If you are developing your own style then you can divide it up into as many different files that you like and place them all somewhere inside the style.
You might want to include a file from one of the built in styles but then you would be relying on it not changing too much in an incompatible way. Having a library of style fragments as a built in style might go a long way to make that more manageable.
So I'll ask another question: if there was a syntax
include some-file from some-style
should the some-style be restricted to a library or any built in style? I am worried that --style-file and --style arguments already cause some confusion.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-- keep on biking and discovering new trails Felix openmtbmap.org & www.velomap.org

Hi, I think if include is used by developers, you wont need include sections, because they will split their style-files into several parts. Eg. one part for address search, one part for routing one part for highways another part for non routable lines and so on. Include a part is only useful, if you include the hole part and also in this case you'll have to be carefull with incompatible usage of Garmin-ID's. Henning Am 05.09.2012 16:27, schrieb Felix Hartmann:
I "would need" or think it's easiest if there would be two things:
a) include_section_XYZ from file_XYZ and b) include_file_XYZ
So you could decide to either include a file containing several sections (so you can have section XY1 section XY2 and so on, for one layout, and section XX1 XX2 for another layout) or include the full content from a file.
In any case, I think naming the relative path of the file should be best. Copying in stuff directly from the mkgmap.jar inbuilt styles, might cause too much errors. You could still copy in stuff from mkgmap inbuilt style, by pointing the file pointer to an mkgmap svn repository directory. --style-file and --style do cause confusion to many people I think. On 05.09.2012 16:06, Steve Ratcliffe wrote:
Hi
Last year, I wanted to divide the default style into modules. It would be easier to continue this with the style-include branch. Perhaps there could be a 'standard library' of files that all styles (including user-defined styles) could include? A library is a good idea.
I don't think that including from other styles is a bad idea, the question is just how do we do it.
If you are developing your own style then you can divide it up into as many different files that you like and place them all somewhere inside the style.
You might want to include a file from one of the built in styles but then you would be relying on it not changing too much in an incompatible way. Having a library of style fragments as a built in style might go a long way to make that more manageable.
So I'll ask another question: if there was a syntax
include some-file from some-style
should the some-style be restricted to a library or any built in style? I am worried that --style-file and --style arguments already cause some confusion.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On Wed, Sep 05, 2012 at 04:56:35PM +0200, aighes wrote:
I think if include is used by developers, you wont need include sections, because they will split their style-files into several parts. Eg. one part for address search, one part for routing one part for highways another part for non routable lines and so on.
Right, that would be my intention. Split the default style and other built-in styles into modules that the default style would include from library files. I think that a relative pathname would be enough, similar to how #include works in the C preprocessor. The default include file path would include the mkgmap library. The library fragments would remain fairly stable. New stuff would be added to new files, not breaking backward compatibility. This might still be useful to combine with the base-style mechanism. Marko

On 05/09/12 15:27, Felix Hartmann wrote:
So you could decide to either include a file containing several sections (so you can have section XY1 section XY2 and so on, for one layout, and section XX1 XX2 for another layout) or include the full content from a file.
I don't really want to add sections to an individual file. It is perfectly possible to create a directory with several files. Eg: you could have a roads 'file' with car and foot sections like so: include "include/roads/car"; include "include/roads/foot"; I have now added the ability to include from a builtin style so you can do: include lines from default; which will include all lines from the default style. ..Steve

Has the version with 'include' been committed yet? Roger On 13/09/2012 22:21, Steve Ratcliffe wrote:
On 05/09/12 15:27, Felix Hartmann wrote:
So you could decide to either include a file containing several sections (so you can have section XY1 section XY2 and so on, for one layout, and section XX1 XX2 for another layout) or include the full content from a file. I don't really want to add sections to an individual file. It is perfectly possible to create a directory with several files. Eg: you could have a roads 'file' with car and foot sections like so:
include "include/roads/car"; include "include/roads/foot";
I have now added the ability to include from a builtin style so you can do:
include lines from default;
which will include all lines from the default style.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-- ------------------------------------------------------------------------ Roger Calvert ------------------------------------------------------------------------

On 24/09/12 16:09, Roger Calvert wrote:
Has the version with 'include' been committed yet?
Its committed, but on a branch and not in the main trunk. However you can download it from http://www.mkgmap.org.uk/snapshots/ as mkgmap-style-include-r2332.jar ..Steve

Thanks, Steve. On 26/09/2012 21:53, Steve Ratcliffe wrote:
On 24/09/12 16:09, Roger Calvert wrote:
Has the version with 'include' been committed yet? Its committed, but on a branch and not in the main trunk. However you can download it from http://www.mkgmap.org.uk/snapshots/ as mkgmap-style-include-r2332.jar
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-- ------------------------------------------------------------------------ Roger Calvert ------------------------------------------------------------------------

yeah, it would really be helpful, to write all the address stuff into one file, and then just include it. Also I share my points and polygons file for two line files, sometimes it would be handy to have little changes in the polygons/points file, but I don't want to have the effort to always update changes to a second file, inlcuding stuff from outside easily, makes maintaining the style files easier. On 31.08.2012 19:06, WanMil wrote:
Hi Steve,
thanks! I've made a basic test and it worked fine for me.
I think it would be nice to be able to include files from other styles. One example are the rules for address tagging to set the mkgmap:country etc. tags. They are required in each style that should create indexed maps.
WanMil
Hi
In the style-include branch (pre-built jar files available at http://www.mkgmap.org.uk/snapshots/) you can now include files from the same style.
The syntax is:
include "filename";
You can put this anywhere where you can start a new rule. The contents of the file "filename" are included at that point in the file, just as you would expect.
You can (and probably should) put the files in a subdirectory and access it as:
include "inc/filename";
A forward slash should be used, even on windows (untested - will fix if it doesn't work).
You don't strictly need the quotes around the filename if it is only letters, but its best to always use them since common filename characters such as '.' and '/' will require the quotes anyway.
An included file can include another file and this can be arbitrarily nested. The name of the file is always relative to the top of the style and not relative to the location of the file that includes it. So if you have a sub-directory 'inc' with files 'first' and 'second' and 'inc/first' wants to include 'second' then it is written as: include "inc/second"; and not: include "second";
You can't yet include files from other styles, maybe that is not really so useful, what do you think?
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-- keep on biking and discovering new trails Felix openmtbmap.org & www.velomap.org
participants (6)
-
aighes
-
Felix Hartmann
-
Marko Mäkelä
-
Roger Calvert
-
Steve Ratcliffe
-
WanMil