Re: [mkgmap-dev] overlays file for POIs
On 18.01.2010 15:18, Marko Mäkelä wrote: > Hi Felix, Steve, > > On Mon, Jan 18, 2010 at 03:00:06PM +0100, Felix Hartmann wrote: > >> rcn_ref=10 [0x02 resolution 24 continue] >> rcn_ref=10 [0x03 resolution 24] --- is identical to the line above and >> will not work. >> > Is there any reason for this? > > I don't know. however if you know how it works, it is quite practical. >> No, the trick is not working, as the you cannot run "continue" for >> asking the same value twice. The idea of continue was more that if you >> have a single node tagged amenity=restaurant& amenity=hotel that >> neither is dropped (so you find both via the search function), or that >> if a line is tagged higwhay=residential& railway=rail both will be >> rendered/included in the map. >> > Could the "continue" allow multiple matches for the same set of keys? > If the "continue" is already in widespread use, we could avoid breaking > compatibility by introducing a "continue_same" keyword. > > Would be best. There are quite a few "prominent" mapmakers using the continue statement. So changing the behaviour will mean adapting the style. >>> Ultimately, I would like to see something like this: >>> >>> (rcn_ref % 100 / 100) = 1 [symbol for '1__' continue] >>> (rcn_ref % 10 / 10) = 1 [ symbol for '_1_' continue] >>> (rcn_ref % 10) = 1 [ symbol for '__1' ] >>> >>> You might need to prefix these rules with rcn_ref=*. >>> >>> >> Well that would be nicer. If you integrate these regex operators, maybe >> you could come up with a conversion for units (mph --> kph) too. >> > Actually, now that you mention regex (quite different from the arithmetics > that I suggested above), you should be able to do something like this: > > rcn_ref=*& rcn_ref~'.*1..' [symbol for '1__' continue] > rcn_ref=*& rcn_ref~'.*1.' [symbol for '_1_' continue] > rcn_ref=*& rcn_ref~'.*1' [symbol for '__1' continue] > and for leading zeroes > rcn_ref=*& rcn_ref> 9& rcn_ref~'.*0.' [symbol for '_0_' continue] > Well that code would work (but not with continue)... so I'll have to adapt it... >> It would be enough if: >> distance=125miles could be seperated into distance=125 >> distance:unit=miles for further processing. >> > OK, this could be doable by setting some variables to what is matched > by the regexp (think of $1, $2 et al of Perl and other languages). > > Marko > ___ > 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
Re: [mkgmap-dev] overlays file for POIs
Felix Hartmann schrieb am 18.01.2010 15:42: > The style branch never worked with "continue" at all, that was the main > problem. At least for me. I can not confirm this. I am using the style branch combined with the continue statement. The style branch is not 100% error free, but in my opinion its style handling is never worse than the trunk. Gruss Torsten ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] overlays file for POIs
On 18.01.2010 15:40, Torsten Leistikow wrote: > Felix Hartmann schrieb am 18.01.2010 15:00: > >> No, the trick is not working, as the you cannot run "continue" for >> asking the same value twice. >> > This is not an intended feature, it is simply a bug in the multiple elements > patch, which made it into the trunk. > > The style branch handles such cases correctly, but sadly it never made it into > the trunk. In my opinion we shouldn't program such workarounds into our > styles, > we just need to find somebody, who can merge the style brunch into the main > trunk. > > The style branch never worked with "continue" at all, that was the main problem. At least for me. > Gruss > Torsten > ___ > 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
Re: [mkgmap-dev] overlays file for POIs
Felix Hartmann schrieb am 18.01.2010 15:00: > No, the trick is not working, as the you cannot run "continue" for > asking the same value twice. This is not an intended feature, it is simply a bug in the multiple elements patch, which made it into the trunk. The style branch handles such cases correctly, but sadly it never made it into the trunk. In my opinion we shouldn't program such workarounds into our styles, we just need to find somebody, who can merge the style brunch into the main trunk. Gruss Torsten ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] overlays file for POIs
Hi Felix, Steve, On Mon, Jan 18, 2010 at 03:00:06PM +0100, Felix Hartmann wrote: > rcn_ref=10 [0x02 resolution 24 continue] > rcn_ref=10 [0x03 resolution 24] --- is identical to the line above and > will not work. Is there any reason for this? > No, the trick is not working, as the you cannot run "continue" for > asking the same value twice. The idea of continue was more that if you > have a single node tagged amenity=restaurant & amenity=hotel that > neither is dropped (so you find both via the search function), or that > if a line is tagged higwhay=residential & railway=rail both will be > rendered/included in the map. Could the "continue" allow multiple matches for the same set of keys? If the "continue" is already in widespread use, we could avoid breaking compatibility by introducing a "continue_same" keyword. > > Ultimately, I would like to see something like this: > > > > (rcn_ref % 100 / 100) = 1 [symbol for '1__' continue] > > (rcn_ref % 10 / 10) = 1 [ symbol for '_1_' continue] > > (rcn_ref % 10) = 1 [ symbol for '__1' ] > > > > You might need to prefix these rules with rcn_ref=*. > > > Well that would be nicer. If you integrate these regex operators, maybe > you could come up with a conversion for units (mph --> kph) too. Actually, now that you mention regex (quite different from the arithmetics that I suggested above), you should be able to do something like this: rcn_ref=* & rcn_ref~'.*1..' [symbol for '1__' continue] rcn_ref=* & rcn_ref~'.*1.' [symbol for '_1_' continue] rcn_ref=* & rcn_ref~'.*1' [symbol for '__1' continue] and for leading zeroes rcn_ref=* & rcn_ref > 9 & rcn_ref~'.*0.' [symbol for '_0_' continue] > It would be enough if: > distance=125miles could be seperated into distance=125 > distance:unit=miles for further processing. OK, this could be doable by setting some variables to what is matched by the regexp (think of $1, $2 et al of Perl and other languages). Marko ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] overlays file for POIs
On 18.01.2010 14:48, Marko Mäkelä wrote: > Hi Felix, > > On Mon, Jan 18, 2010 at 02:19:45PM +0100, Felix Hartmann wrote: > >> Actually I found two ways how to make it work. Sometimes the mkgmap >> style-file code allows so many nice workarounds. :-) >> >> *a)* the odd way >> rcn_ref=*& rcn_ref=10{ name '${rcn_ref}' } [0x01701 resolution 22 >> continue] >> rcn_ref=10{ name '${rcn_ref}' } [0x01800 >> resolution 22] >> >> *b)* the logic way (which can be used for even more than 2 symbols) - >> > Why couldn't the odd way be used for several symbols? > Well, it will only once be considered as different. example: rcn_ref=* & rcn_ref=10 [0x01 resolution 24 continue] rcn_ref=10 [0x02 resolution 24 continue] rcn_ref=10 [0x03 resolution 24] --- is identical to the line above and will not work. > Would having multiple rcn_ref=*& at the start of the rule help? > That could well be possible. I have not tried it. > Why do you need the rcn_ref=*& anyway? Shouldn't the continue > do the trick already? > No, the trick is not working, as the you cannot run "continue" for asking the same value twice. The idea of continue was more that if you have a single node tagged amenity=restaurant & amenity=hotel that neither is dropped (so you find both via the search function), or that if a line is tagged higwhay=residential & railway=rail both will be rendered/included in the map. > Ultimately, I would like to see something like this: > > (rcn_ref % 100 / 100) = 1 [symbol for '1__' continue] > (rcn_ref % 10 / 10) = 1 [ symbol for '_1_' continue] > (rcn_ref % 10) = 1 [ symbol for '__1' ] > > You might need to prefix these rules with rcn_ref=*. > Well that would be nicer. If you integrate these regex operators, maybe you could come up with a conversion for units (mph --> kph) too. It would be enough if: distance=125miles could be seperated into distance=125 distance:unit=miles for further processing. > Removing leading zeros would take some further conditions, something > like this: > > rcn_ref> 9& (rcn_ref % 10 / 10) = 0 [ symbol for '_0_' continue] > > and (if we are to support rcn_ref> 999) > > rcn_ref> 99& (rcn_ref % 100 / 100) = 0 [ symbol for '0__' continue] > > Currently, the parser does not support arithmetic operators such > as /, %, *, +, -. Integer arithmetics should be easy implement. > Currently I have the following in my style-file for this (I will change it around a bit, for better searchability, and effectively create 3 POI out of each node (by set mkgmap:rcn_ref=...; set mkgmap:1rcn_ref=; name...} I just have to search for matching IDs). I will experiment a bit with deleting the name key too. rcn_ref=* & rcn_ref > 89 & rcn_ref < 100 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}'} [0x01709 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 79 & rcn_ref < 90 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01708 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 69 & rcn_ref < 80 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01707 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 59 & rcn_ref < 70 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01706 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 49 & rcn_ref < 60 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01705 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 39 & rcn_ref < 50 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01704 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 29 & rcn_ref < 40 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01703 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 19 & rcn_ref < 30 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01702 resolution 21 continue with_actions] rcn_ref=* & rcn_ref > 9 & rcn_ref < 20 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x01701 resolution 21 continue with_actions] mkgmap:rcn_ref=10 | mkgmap:rcn_ref=20 | mkgmap:rcn_ref=30 | mkgmap:rcn_ref=40 | mkgmap:rcn_ref=50 | mkgmap:rcn_ref=60 | mkgmap:rcn_ref=70 | mkgmap:rcn_ref=80 | mkgmap:rcn_ref=90 { name '${rcn_ref}' } [0x01800 resolution 21] mkgmap:rcn_ref=11 | mkgmap:rcn_ref=21 | mkgmap:rcn_ref=31 | mkgmap:rcn_ref=41 | mkgmap:rcn_ref=51 | mkgmap:rcn_ref=61 | mkgmap:rcn_ref=71 | mkgmap:rcn_ref=81 | mkgmap:rcn_ref=91 { name '${rcn_ref}' } [0x01801 resolution 21] mkgmap:rcn_ref=12 | mkgmap:rcn_ref=22 | mkgmap:rcn_ref=32 | mkgmap:rcn_ref=42 | mkgmap:rcn_ref=52 | mkgmap:rcn_ref=62 | mkgmap:rcn_ref=72 | mkgmap:rcn_ref=82 | mkgmap:rcn_ref=92 { name '${rcn_ref}' } [0x01802 resolution 21] mkgmap:rcn_ref=13 | mkgmap:rcn_ref=23 | mkgmap:rcn_ref=33 | mkgmap:rcn_ref=43 | mkgmap:rcn_ref=53 | mkgmap:rcn_ref=63 | mkgmap:rcn_ref=73 | mkgmap:rcn_ref=83 | mkgmap:rcn_ref=93 { name '${rcn_ref}' } [0x01803 resolution 21] mkgmap:rcn_ref=14 | mkgmap:rcn_ref=24 | mkgmap:rcn_ref=34 | mkgmap:rcn_ref=44 | mkgmap:
Re: [mkgmap-dev] overlays file for POIs
Hi Felix, On Mon, Jan 18, 2010 at 02:19:45PM +0100, Felix Hartmann wrote: > Actually I found two ways how to make it work. Sometimes the mkgmap > style-file code allows so many nice workarounds. :-) > > *a)* the odd way > rcn_ref=* & rcn_ref=10{ name '${rcn_ref}' } [0x01701 resolution 22 > continue] > rcn_ref=10{ name '${rcn_ref}' } [0x01800 > resolution 22] > > *b)* the logic way (which can be used for even more than 2 symbols) - Why couldn't the odd way be used for several symbols? Would having multiple rcn_ref=*& at the start of the rule help? Why do you need the rcn_ref=*& anyway? Shouldn't the continue do the trick already? Ultimately, I would like to see something like this: (rcn_ref % 100 / 100) = 1 [symbol for '1__' continue] (rcn_ref % 10 / 10) = 1 [ symbol for '_1_' continue] (rcn_ref % 10) = 1 [ symbol for '__1' ] You might need to prefix these rules with rcn_ref=*. Removing leading zeros would take some further conditions, something like this: rcn_ref > 9 & (rcn_ref % 10 / 10) = 0 [ symbol for '_0_' continue] and (if we are to support rcn_ref > 999) rcn_ref > 99 & (rcn_ref % 100 / 100) = 0 [ symbol for '0__' continue] Currently, the parser does not support arithmetic operators such as /, %, *, +, -. Integer arithmetics should be easy implement. Marko ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] overlays file for POIs
Actually I found two ways how to make it work. Sometimes the mkgmap style-file code allows so many nice workarounds. :-) *a)* the odd way rcn_ref=* & rcn_ref=10{ name '${rcn_ref}' } [0x01701 resolution 22 continue] rcn_ref=10{ name '${rcn_ref}' } [0x01800 resolution 22] *b)* the logic way (which can be used for even more than 2 symbols) - actually it can be used to make as many overlays as one would like to have (only adds a bit of code to the style-files, using an overlays file would be a bit "cleaner"). rcn_ref=11{ set mkgmap:rcn_ref=11; name '${rcn_ref}' } [0x01701 resolution 22 continue with_actions] mkgmap:rcn_ref=11{ name '${rcn_ref}' } [0x01801 resolution 22] Now that we know both ways we can think of how to achieve our goal while using the fewest code (assuming 0-99 only, if 0-999 it would be a bit more complex) rcn_ref=* & rcn_ref > 90 & rcn_ref < 99 { set mkgmap:rcn_ref='${rcn_ref}'; name '${rcn_ref}' } [0x. continue with_actions] rcn_ref=* & rcn_ref > 80 & rcn_ref < 89 . We need rcn_ref=* in this case, because dropping it makes it invalid for mkgmap style-parser ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] overlays file for POIs
On 16.01.2010 22:45, Marko Mäkelä wrote: > On Sat, Jan 16, 2010 at 07:37:01PM +0100, Felix Hartmann wrote: > >> Hi, would it be possible to integrate an overlays file for POIs? The >> current overlays file (inside the style-file) only works for polylines. >> I would like to do the same for POIs. (I don't think it is needed for >> polygons, but maybe someone has creative ideas in his head and would >> like to have it for polygons too). >> >> I don't manage to program this, but I hope that it proves easy as we >> already have that functionality for lines. Would be great if it could be >> integrated. I tried to do it by using "continue" but this does not work. >> (continue will only work if the key or value is different). >> > Could the "continue" action be made to work? Such rules might be easier > to follow than overlay definitions, but I guess it is a matter of taste. > I like that the "continue" command will not continue for the same key on one object so: keya=123 {set;do...} [continue] keya=123 {do...} [continue] ... will not be used keyb=123 [] the overlays howerever just duplicates something to a second or third id, which is useful for combinations. Both for me serve a different purpose. There is some overlap, but some things can only be done using "continue" (or better it saves you many lines in your style-file), while duplicating can only be done by the overlays file. > As far as I can tell from the source code, the following pieces of code > implement the line overlays: > > StyleImpl.getOverlays(LineAdder) > * called by StyledConverter constructor > * wraps calls to the passed LineAdder.addLine() by OverlayReader.addLine() > * the passed LineAdder would be this one defined in StyledConverter: > private LineAdder lineAdder = new LineAdder() { > public void add(MapLine element) { > if (element instanceof MapRoad) > collector.addRoad((MapRoad) element); > else > collector.addLine(element); > } > }; > > You would have to implement something similar around > StyledConverter.addPoint() > or StyledConverter.collector.addPoint(). > > I find your example use case of symbols for public transportation stops > extremely useful. I hope that someone will make this happen. Sorry, > there are only so many hours in my days, and the top priority on my "roadmap" > is to create multi-layered maps. > > By the way, house numbers and bike route numbers could be useful to put on > user-selectable map layers. Couldn't you actually create the numbers as > text labels? Could the addresslayer_style of > http://wiki.openstreetmap.org/wiki/DE:All_in_one_Garmin_Map > be doing exactly that? > No that is in my eyes rubbish and trying to circumvent that mkgmap cannot yet correctly write the address search. It makes it possible to search for addresses as POI and places a POI for each address (yes you see a number, but you cannot controll whether Mapsource/GPS shows a text or not), but can never replace a fully working address index. I'm not really a fan of using a map being composed by several mapsets, if it can be put into one layer or mapset, as setting tiles transparent often causes problems and mapsource can only display one mapset at a time. My example for the numbers would be always shown at the resolutions specifed and not at the mercy of what Mapsource/GPS deems important (label shown, label dropped). > Best regards, > > Marko > ___ > 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
Re: [mkgmap-dev] overlays file for POIs
On Sat, Jan 16, 2010 at 07:37:01PM +0100, Felix Hartmann wrote: > Hi, would it be possible to integrate an overlays file for POIs? The > current overlays file (inside the style-file) only works for polylines. > I would like to do the same for POIs. (I don't think it is needed for > polygons, but maybe someone has creative ideas in his head and would > like to have it for polygons too). > > I don't manage to program this, but I hope that it proves easy as we > already have that functionality for lines. Would be great if it could be > integrated. I tried to do it by using "continue" but this does not work. > (continue will only work if the key or value is different). Could the "continue" action be made to work? Such rules might be easier to follow than overlay definitions, but I guess it is a matter of taste. As far as I can tell from the source code, the following pieces of code implement the line overlays: StyleImpl.getOverlays(LineAdder) * called by StyledConverter constructor * wraps calls to the passed LineAdder.addLine() by OverlayReader.addLine() * the passed LineAdder would be this one defined in StyledConverter: private LineAdder lineAdder = new LineAdder() { public void add(MapLine element) { if (element instanceof MapRoad) collector.addRoad((MapRoad) element); else collector.addLine(element); } }; You would have to implement something similar around StyledConverter.addPoint() or StyledConverter.collector.addPoint(). I find your example use case of symbols for public transportation stops extremely useful. I hope that someone will make this happen. Sorry, there are only so many hours in my days, and the top priority on my "roadmap" is to create multi-layered maps. By the way, house numbers and bike route numbers could be useful to put on user-selectable map layers. Couldn't you actually create the numbers as text labels? Could the addresslayer_style of http://wiki.openstreetmap.org/wiki/DE:All_in_one_Garmin_Map be doing exactly that? Best regards, Marko ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] overlays file for POIs
Just to show that it works (at least under Mapsource and my Vista HCx) This number is actually made out of one POI in osm format but I used to different keys and "continue" to get it working. ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] overlays file for POIs
Hi, would it be possible to integrate an overlays file for POIs? The current overlays file (inside the style-file) only works for polylines. I would like to do the same for POIs. (I don't think it is needed for polygons, but maybe someone has creative ideas in his head and would like to have it for polygons too). I don't manage to program this, but I hope that it proves easy as we already have that functionality for lines. Would be great if it could be integrated. I tried to do it by using "continue" but this does not work. (continue will only work if the key or value is different). This does not work currently either (and the overlays function would be much better for this example anyhow): rcn_ref=10[0x1800 resolution 22 continue] rcn_ref=10[0x1701 resolution 22] *For what could we use it?* *1.* By creating invisible POIs and a visible point one could have different icons for different POIs however they would still be found under the same category. e.g. we know that 0x2f08 is found under transport --> ground transportation. We would like to have different symbols for a tube entrance, a bus_station a bus_halt, but would like all of them to show up under the search for ground transportation. so I would like to have in my "points" file the following entries: railway=subway_entrance { name 'tube ${name} ${ref}' | 'tube ${ref}' | 'tube ${name}' | 'tube' } [0x2f0801 resolution 22] railway=tram_stop { name 'tram_stop ${name} ${tram_lines} ${ref}' | 'tram_stop ${name}'} [0x2f0802 resolution 23] amenity=bus_stop { name 'bus_stop ${name} ${ref} ${bus_lines} ${operator}' | 'bus_stop ${name}' | 'bus_stop'} [0x2f0803 resolution 24] . now we know there are no 6 digit points code, therefore in our new pointsoverlay file we put 0x2f0801: 0x2f08, 0x1700 0x2f0802: 0x2f08, 0x1701 0x2f0803: 0x2f08, 0x1702 in our typfile we make 0x2f08 invisble, and create 3 nice icons to have a different layout for the different POI. *2.* In the netherlands and some other countries there are nodes with a number from 0-99 that are part of a cycle node network. I would like to display these points with an icon showing the number(and that is the real problem I face). We could add nice icons showing a number for rcn_ref=* * being a number from 0-99 (if it is 0-999 it would make even more sense). Currently I would have to create 100 different icons in my .TYPfile to be able to put a numbers from 0-99 on my map. If we had an overlays file I can reduce this to 20 icons in my Typfile and it would use only 20 ids instead of 100. (by having one icon for the "decimal number", and one icon for the right number). They should be displayed side by side by making half of the icon transparent, once to the left, once to the right. The same could be done for housenumbers (imagine designing 1000 entries in the typfile for numbers from 0-999, and only 30 if we would have an pointsoverlay file). *3.* we have the same for polylines and it has proven very useful. The overlays file currently only works for lines. ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev