mp/hh / km/h m or other units in maxspeed or distance keys

Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this? It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may have missed). As I'm sure this would take quite some time, it should be an option, and there should be a style-file called units_removed where you can specify the keys for which mkgmap should do this. Of course an implementation of automatically translating mp/h to km/h and other things would be great to have too, but the above is IMHO first of main importance. The problem is simply that commands like maxspeed>50 or distance<10 don't work otherwise. -- keep on biking and discovering new trails Felix openmtbmap.org & www.velomap.org

On 28 Aug 2012, at 11:36, Felix Hartmann <extremecarver@gmail.com> wrote:
Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this?
It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may have missed).
As I'm sure this would take quite some time, it should be an option, and there should be a style-file called units_removed where you can specify the keys for which mkgmap should do this.
Of course an implementation of automatically translating mp/h to km/h and other things would be great to have too, but the above is IMHO first of main importance. The problem is simply that commands like maxspeed>50 or distance<10 don't work otherwise.
-- keep on biking and discovering new trails
Felix openmtbmap.org & www.velomap.org
Isn't this a problem with the OSM data entry that would be better solved by a bot working on the data? Or are you just looking for a pragmatic solution through mkgmap?

On 28.08.2012 10:59, Charlie Ferrero wrote:
On 28 Aug 2012, at 11:36, Felix Hartmann <extremecarver@gmail.com> wrote:
Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this?
It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may have missed).
As I'm sure this would take quite some time, it should be an option, and there should be a style-file called units_removed where you can specify the keys for which mkgmap should do this.
Of course an implementation of automatically translating mp/h to km/h and other things would be great to have too, but the above is IMHO first of main importance. The problem is simply that commands like maxspeed>50 or distance<10 don't work otherwise.
-- keep on biking and discovering new trails
Felix openmtbmap.org & www.velomap.org
Isn't this a problem with the OSM data entry that would be better solved by a bot working on the data? Or are you just looking for a pragmatic solution through mkgmap?
Nope, because when I proposed to move units to their own key value, I got only disagreements. Seems the general opinion is highly in favour of putting the unit into the value, hence mkgmap needs to work around it to make it usable. ( I don't know if it does, for the current maxspeed stuff (which is anyhow IMHO AFAIK still heavily flawed, in so far that it adjusts the road_speed up, while it would be much better if it only decreases the road_speed). -- keep on biking and discovering new trails Felix openmtbmap.org & www.velomap.org

On Tue, Aug 28, 2012 at 10:36:59AM +0200, Felix Hartmann wrote:
Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this?
It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may have missed).
I think that this should be done in the (default) style file, not in the mkgmap core. We already have a regexp matching operator, and if I remember correctly, we should also have regexp replace in the action rules. But, I would wait a bit until Steve has overhauled the include mechanism in the style file parser.
As I'm sure this would take quite some time, it should be an option, and there should be a style-file called units_removed where you can specify the keys for which mkgmap should do this.
Hmm, parameterized style rules and actions? Sort of macro or template expansion in the style processor? Best regards, Marko

On 28.08.2012 13:06, Marko Mäkelä wrote:
On Tue, Aug 28, 2012 at 10:36:59AM +0200, Felix Hartmann wrote:
Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this?
It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may have missed). I think that this should be done in the (default) style file, not in the mkgmap core. We already have a regexp matching operator, and if I remember correctly, we should also have regexp replace in the action rules.
But, I would wait a bit until Steve has overhauled the include mechanism in the style file parser. Could you give an example of how to do it?
I do understand the reqgexp not well enough, to split up values into to keys! I didn't know this was possible - so I'ld like to try it out. If it's possible, then yes of course, this should go into the default style. My change wish, was based on the knowledge that this is not possible (about 2 years ago it certainly was not).

On Tue, Aug 28, 2012 at 02:30:43PM +0200, Felix Hartmann wrote:
I do understand the reqgexp not well enough, to split up values into to keys! I didn't know this was possible - so I'ld like to try it out.
Sorry, I only found evidence of a substring replace operator, not of regexp replace: waterway=depth & name=* { name '${name|subst:,=>.}' } [ 0x6200 resolution 22] In the source code, this is SubstitutionFilter. I also see HeightFilter and ConvertFilter. There does not seem to be any RegexpFilter. I am not sure, but SubstringFilter might be useable in special cases (removing prefixes, not sure if you can remove suffixes with it).
If it's possible, then yes of course, this should go into the default style. My change wish, was based on the knowledge that this is not possible (about 2 years ago it certainly was not).
Anything is possible. Whether it is reasonable is another matter. :-) Marko

Mkgmap already splits a number with a unit into its numeric and unit parts and always has done. Also just a small amount of code would be required to convert to a common unit before comparing. Or am I misunderstanding, or is there a bug? ..Steve Felix Hartmann <extremecarver@gmail.com> wrote:
Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this?
It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may
have missed).
As I'm sure this would take quite some time, it should be an option, and there should be a style-file called units_removed where you can specify
the keys for which mkgmap should do this.
Of course an implementation of automatically translating mp/h to km/h and other things would be great to have too, but the above is IMHO first of main importance. The problem is simply that commands like maxspeed>50 or distance<10 don't work otherwise.

Yes, but one cannot access the unit so far. speed>50 with value 50mp/h or 50m or 50km/h or plain 50 will always yield the same result, or thats what I understood so far. On 28.08.2012 15:22, Steve Ratcliffe wrote:
Mkgmap already splits a number with a unit into its numeric and unit parts and always has done.
Also just a small amount of code would be required to convert to a common unit before comparing.
Or am I misunderstanding, or is there a bug?
..Steve
Felix Hartmann <extremecarver@gmail.com> wrote:
Well it's quite a long time, there has been no discussion about this, however it's more and more common to put the unit into the main key. Could mkgmap do a clean up on this?
It would be great if mkgmap could do the following: Remove any non numeric keys (and not "." or "," ) and place them into a new key called mkgmap:unit=.... Do this for maxspeed, distance, height, width (propose other keys I may
have missed).
As I'm sure this would take quite some time, it should be an option, and there should be a style-file called units_removed where you can specify
the keys for which mkgmap should do this.
Of course an implementation of automatically translating mp/h to km/h and other things would be great to have too, but the above is IMHO first of main importance. The problem is simply that commands like maxspeed>50 or distance<10 don't work otherwise.
-- keep on biking and discovering new trails Felix openmtbmap.org & www.velomap.org

On 28/08/12 16:25, Felix Hartmann wrote:
Yes, but one cannot access the unit so far.
speed>50 with value 50mp/h or 50m or 50km/h or plain 50 will always yield the same result, or thats what I understood so far.
Yes that is true. I wasn't really clear what you were asking and how it would work. I'm guessing it would be something like this: maxspeed=* {set mkgmap:unit="${maxspeed|unit}" } mkgmap:unit=mph & maxspeed < 40 .... mkgmap:unit=kmh & maxspeed < 64 ... Anyway it should be easy to make maxspeed < 40mph just work, so lets do it. ..Steve
participants (4)
-
Charlie Ferrero
-
Felix Hartmann
-
Marko Mäkelä
-
Steve Ratcliffe