!< not working -- problem with conditions in style-file.

There is a problem in the style handling. "!<" is not working. Assume I would like to reverse the statement layer<0 into meaning layer < 0 does not exist. Currently I could write layer!=-1 & layer!=-2 and so on. But that sums up to quite a lot of text. Essentially I would like to have the following statement shorter...: & ( tracktype!=1 | tracktype!=2 | tracktype!=3 | tracktype!=4 | tracktypeadded=yes ) but replacing it with & (tracktype!<5 | tracktypeadded=yes ) does not yield the same outcome. Have I got a logical problem, or is it mkgmap?

On Wed, Nov 17, 2010 at 07:43:32PM +0100, Felix Hartmann wrote:
There is a problem in the style handling. "!<" is not working.
How should it work? I haven't seen such an operator in any language. The SGML start-of-comment <! comes closest. Is there a reason why you cannot use >=, or is that not working either? Marko

Hello instead of !< you could use => or >=. I don't know if there is a difference. For example: & ( tracktype>=5 | tracktypeadded=yes ) -- View this message in context: http://gis.638310.n2.nabble.com/not-working-problem-with-conditions-in-style... Sent from the Mkgmap Development mailing list archive at Nabble.com.

aighes schrieb am 17.11.2010 20:21:
instead of !< you could use => or >=. I don't know if there is a difference. For example: & ( tracktype>=5 | tracktypeadded=yes )
I think he wants to have (tracktype!=* | tracktype<5) The difference is, when there is no tracktype defined at all. Gruss Torsten

On 17.11.2010 20:32, Torsten Leistikow wrote:
aighes schrieb am 17.11.2010 20:21:
instead of !< you could use => or>=. I don't know if there is a difference. For example: & ( tracktype>=5 | tracktypeadded=yes ) I think he wants to have
(tracktype!=* | tracktype<5)
The difference is, when there is no tracktype defined at all. For all ways that have no tracktype, I add a tracktype if I think a certain surface value reflects a tracktype. Then later on however, depending or not whether the tracktype existed naturally or was added based on surface, do or do not do an action. And this action is also dependant on the value of the tracktype itself.
The full command working goes like this: sac_scale=hiking & ((tracktype!=1 | tracktype!=2 | tracktype!=3 | tracktype!=4) | tracktypeadded=yes ) [0x07 ...] And I tried to shorten it by changing it to sac_scale=hiking & ( tracktype!<5 | tracktypeadded=yes) but this does not give the same result - because for tracktype=5 the condition of tracktype smaller 5 not existing was not fullfilled. (double negation - seams not to be like by programmers either...). Or in more detail so you can understand what I want. Below is the outcome I want to have for tracktype=1 and respectively tracktype=5 if tracktypeadded=yes THEN build 0x07 (no matter if tracktype exists, and no matter which value it has). if tracktype=5 THEN do build 0x07 (if tracktype does not exist, or tracktype has any value but 1-4 then it should also go through) if tracktype=1 but tracktypeadded!=yes THEN do not build 0x07 ((tracktype!=* | tracktype<5) | tracktypeadded=yes) does not work because the outcome would be if tracktypeadded=yes THEN build 0x07 if tracktype=5 THEN do no build 0x07!!!!!!!!!!! if tracktype=1 THEN do not build 0x07 !!!!!!! is the problem. Because in case that neither tracktype is under 5 nor tracktypeadded=yes I still do want 0x07 to be built. What actually works and at the same time makes the command shorter is: sac_scale=hiking & ((tracktype!=* | tracktype>4) | tracktypeadded=yes) still I would fine sac_scale=hiking & ( tracktype!<5 | tracktypeadded=yes) to be more elegant and shorter (though yes I do admit, double negations do cause confusion).

Felix Hartmann schrieb am 17.11.2010 22:30:
Below is the outcome I want to have for tracktype=1 and respectively tracktype=5 if tracktypeadded=yes THEN build 0x07 (no matter if tracktype exists, and no matter which value it has). if tracktype=5 THEN do build 0x07 (if tracktype does not exist, or tracktype has any value but 1-4 then it should also go through) if tracktype=1 but tracktypeadded!=yes THEN do not build 0x07
I am not sure, I understand your intention correctly. So I will provide a table for the tracktype value and the expected outcome (tracktypeadded!=yes is always assumed, since this extra condition shouldn't be the problem): tracktype - build 0x07 not set no 1 no 2 no 3 no 4 no 5 yes any other value no This should be achieved by (tracktypeadded=yes | tracktype=5) This look so easy, so I probably have misunderstood your intention. So please provide such a table with your expected outcome. Gruss Torsten

On 18.11.2010 16:52, Torsten Leistikow wrote:
Felix Hartmann schrieb am 17.11.2010 22:30:
Below is the outcome I want to have for tracktype=1 and respectively tracktype=5 if tracktypeadded=yes THEN build 0x07 (no matter if tracktype exists, and no matter which value it has). if tracktype=5 THEN do build 0x07 (if tracktype does not exist, or tracktype has any value but 1-4 then it should also go through) if tracktype=1 but tracktypeadded!=yes THEN do not build 0x07 I am not sure, I understand your intention correctly. So I will provide a table for the tracktype value and the expected outcome (tracktypeadded!=yes is always assumed, since this extra condition shouldn't be the problem):
tracktype - build 0x07 not set no 1 no 2 no 3 no 4 no 5 yes any other value no
This should be achieved by (tracktypeadded=yes | tracktype=5)
This look so easy, so I probably have misunderstood your intention. So please provide such a table with your expected outcome.
Gruss Torsten
table should look like this for "tracktype!<4" tracktype - build 0x07 not set yes <1 no 1 no 2 no 3 no 4 no 5 yes
5 yes any other value yes
(any other value, meaning non numeric). this can currently be achieved by ( tracktypeadded=yes | (tracktype!=* | tracktype>4 )) but I think for the above command the easier structure would be ( tracktypeadded=yes | tracktype!<5 )

Felix Hartmann schrieb am 18.11.2010 17:18:
table should look like this for "tracktype!<4"
tracktype - build 0x07 not set yes <1 no 1 no 2 no 3 no 4 no 5 yes
5 yes any other value yes
(any other value, meaning non numeric). this can currently be achieved by ( tracktypeadded=yes | (tracktype!=* | tracktype>4 ))
I think not not, any non-numeric value for tracktype would give a different result than your table.
but I think for the above command the easier structure would be ( tracktypeadded=yes | tracktype!<5 )
I think inventing such an operator would be a bad idea. It would be much easier to have a genenral negation i.e. !(expression) But in general you can rework any boolean expression by exchanging the operators, so that you coul go without a simple negation. Gruss Torsten

Hi
I think inventing such an operator would be a bad idea. It would be much easier to have a genenral negation i.e.
!(expression)
The style rules already allow general negation. If I've understood the conversation, then: !(tracktype < 5) does exactly what Felix wants it to do. ..Steve

On 18.11.2010 23:34, Steve Ratcliffe wrote:
Hi
I think inventing such an operator would be a bad idea. It would be much easier to have a genenral negation i.e.
!(expression) The style rules already allow general negation.
If I've understood the conversation, then:
!(tracktype< 5)
does exactly what Felix wants it to do.
..Steve This would work for a single condition. But not for does not exist or. (or else I'm too stupid). However I think something like this won't work So would (!(tracktype<5)|condition2=yes) work? Meaning either tracktype not equal smaller 5 or condition2=yes - one of the two has to match for it to not stop the action. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi
However I think something like this won't work So would (!(tracktype<5)|condition2=yes) work? Meaning either tracktype not equal smaller 5 or condition2=yes - one of the two has to match for it to not stop the action.
Yes it would work. Here is an example, only WAY 2 is not converted. WAY 2 and 5 differ only in condition2=yes WAY 1 highway=track WAY 2 highway=track tracktype=3 WAY 3 highway=track tracktype=5 WAY 4 highway=track tracktype=fjdk WAY 5 highway=track tracktype=3 condition2=yes <<<lines>>> highway=track & (!(tracktype<5)|condition2=yes) [0x1] <<<polygons>>> <<<results>>> WAY 1: Line 0x1, name=<null>, ref=<null>, res=24-24 (1/1),(2/2), WAY 3: Line 0x1, name=<null>, ref=<null>, res=24-24 (1/1),(2/2), WAY 4: Line 0x1, name=<null>, ref=<null>, res=24-24 (1/1),(2/2), WAY 5: Line 0x1, name=<null>, ref=<null>, res=24-24 (1/1),(2/2),
participants (5)
-
aighes
-
Felix Hartmann
-
Marko Mäkelä
-
Steve Ratcliffe
-
Torsten Leistikow