Weird road speed

Hi, I have observed weird road speeds when using current mkgmap r2977. See this way: http://www.openstreetmap.org/way/227105752 It has no maxspeed tag. It should be rendered as primary road, speed class 4. This is what I get, if I disable including "roadspeed" file from default style. With "roadspeed" all is different and depends on tile area. I have prepared sample data, where this road get speed class 6. Croping a bit tile area (outside the road) changes speed class to 3. See picture showing both cases, dark blue is class 6, green is class 3: http://files.mkgmap.org.uk/download/173/speed-problem.png I have prepared an example of source data: http://files.mkgmap.org.uk/download/172/speed-problem.7z It contains source data and a poly file for cropping. I have included batches, that I have used for creating maps. Actually I'm not sure, what is the behavior of mkgmap:road-speed-class tag. I couldn't find any description. For example if I define a road like [0x03 road_class=3 road_speed=4 resolution 19], does it create mkgmap:road-speed-class=4? -- Best regards, Andrzej

Hi, you can find a rather complete documentation of all mkgmap:* tags in the mkgmap style documentation (http://www.mkgmap.org.uk/doc/index.html). Please let us know if you miss something. If you have a problem with a specific way I propose to use the following rule in the finalize block of the lines file: osmid()=227105752 & highway=* { echotags "Wrong roadspeed?" } This prints out all tags for way 227105752. WanMil
Hi,
I have observed weird road speeds when using current mkgmap r2977. See this way: http://www.openstreetmap.org/way/227105752
It has no maxspeed tag. It should be rendered as primary road, speed class 4. This is what I get, if I disable including "roadspeed" file from default style.
With "roadspeed" all is different and depends on tile area. I have prepared sample data, where this road get speed class 6. Croping a bit tile area (outside the road) changes speed class to 3. See picture showing both cases, dark blue is class 6, green is class 3: http://files.mkgmap.org.uk/download/173/speed-problem.png
I have prepared an example of source data: http://files.mkgmap.org.uk/download/172/speed-problem.7z
It contains source data and a poly file for cropping. I have included batches, that I have used for creating maps.
Actually I'm not sure, what is the behavior of mkgmap:road-speed-class tag. I couldn't find any description. For example if I define a road like [0x03 road_class=3 road_speed=4 resolution 19], does it create mkgmap:road-speed-class=4?

Hi WanMil
you can find a rather complete documentation of all mkgmap:* tags in the mkgmap style documentation
Thanks, this was the first place where I have looked, I don't know how could I miss it.
osmid()=227105752 & highway=* { echotags "Wrong roadspeed?" }
It is nice debugging facility. This is what I have found: All tags displayed by echotags look correctly. Value from mkgmap:road-speed-class is applied wrongly! In case of my sample data way ID=227105752 gets value computed for way ID=227105746, which is tagged as maxspeed=100. If I set other maxspeed for way ID=227105746 then this value appears at way ID=227105752. Cropping input data removes way ID=227105746 and speed for ID=227105752 changes, but still is wrong. I have checked speeds in img using GPSMapEdit and verified with nuvi in route simulation. It is serious bug in mkgmap. -- Best regards, Andrzej

Cheers, I can confirm that there is a strange behavior of the road speed generation. My first test with the echotags function, indicates that roads without maxspeed value, are handled if they had one. A simple "highway=primary" (and no more tags) cause trouble. Please see tha attached test case. My mkgmap version is 2946 Best regards, Manfred
Gesendet: Sonntag, 19. Januar 2014 um 20:11 Uhr Von: "Andrzej Popowski" <popej@poczta.onet.pl> An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] Weird road speed
Hi WanMil
you can find a rather complete documentation of all mkgmap:* tags in the mkgmap style documentation
Thanks, this was the first place where I have looked, I don't know how could I miss it.
osmid()=227105752 & highway=* { echotags "Wrong roadspeed?" }
It is nice debugging facility. This is what I have found:
All tags displayed by echotags look correctly.
Value from mkgmap:road-speed-class is applied wrongly!
In case of my sample data way ID=227105752 gets value computed for way ID=227105746, which is tagged as maxspeed=100. If I set other maxspeed for way ID=227105746 then this value appears at way ID=227105752. Cropping input data removes way ID=227105746 and speed for ID=227105752 changes, but still is wrong.
I have checked speeds in img using GPSMapEdit and verified with nuvi in route simulation. It is serious bug in mkgmap.
-- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi WanMil, I think the problem is StyledConverter.postConvertRules(). This calls e.g. recalcRoadSpeed() which modifies the global instance of the GType. In addConvertedWay() the GType instance is copied, but postConvertRules() is called earlier. Gerd Manfred Brenneisen-2 wrote
Cheers,
I can confirm that there is a strange behavior of the road speed generation. My first test with the echotags function, indicates that roads without maxspeed value, are handled if they had one. A simple "highway=primary" (and no more tags) cause trouble. Please see tha attached test case. My mkgmap version is 2946
Best regards, Manfred
Gesendet: Sonntag, 19. Januar 2014 um 20:11 Uhr Von: "Andrzej Popowski" <
popej@.onet
>
An:
mkgmap-dev@.org
Betreff: Re: [mkgmap-dev] Weird road speed
Hi WanMil
you can find a rather complete documentation of all mkgmap:* tags in the mkgmap style documentation
Thanks, this was the first place where I have looked, I don't know how could I miss it.
osmid()=227105752 & highway=* { echotags "Wrong roadspeed?" }
It is nice debugging facility. This is what I have found:
All tags displayed by echotags look correctly.
Value from mkgmap:road-speed-class is applied wrongly!
In case of my sample data way ID=227105752 gets value computed for way ID=227105746, which is tagged as maxspeed=100. If I set other maxspeed for way ID=227105746 then this value appears at way ID=227105752. Cropping input data removes way ID=227105746 and speed for ID=227105752 changes, but still is wrong.
I have checked speeds in img using GPSMapEdit and verified with nuvi in route simulation. It is serious bug in mkgmap.
-- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
_______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Unbenannt 1.pdf (156K) <http://gis.19327.n5.nabble.com/attachment/5793637/0/Unbenannt%201.pdf>
-- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793640.html Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi Andrzej, I can confirm that way 227105752 seems to get a wrong road speed when using your sample data. ("seems" because that's what GMapEdit tells me - there is no guarantee that there isn't a bug in GMapEdit) I have done some tests and found a problem in mkgmap which need to be fixed although I cannot say now that it is the source of the described problem. @Gerd: StyledConverter.postConvertRules can change the road speed in the type. But this hasn't been copied before so I guess it's changing the global type of the rule. Can you check that? I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem. WanMil
Hi WanMil
you can find a rather complete documentation of all mkgmap:* tags in the mkgmap style documentation
Thanks, this was the first place where I have looked, I don't know how could I miss it.
osmid()=227105752 & highway=* { echotags "Wrong roadspeed?" }
It is nice debugging facility. This is what I have found:
All tags displayed by echotags look correctly.
Value from mkgmap:road-speed-class is applied wrongly!
In case of my sample data way ID=227105752 gets value computed for way ID=227105746, which is tagged as maxspeed=100. If I set other maxspeed for way ID=227105746 then this value appears at way ID=227105752. Cropping input data removes way ID=227105746 and speed for ID=227105752 changes, but still is wrong.
I have checked speeds in img using GPSMapEdit and verified with nuvi in route simulation. It is serious bug in mkgmap.

WanMil wrote
I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem.
hmm, is it possible that this line has no effect? Please try something like GType typeCopy = new GType(type); Gerd -- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793641.html Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi, attached is a patch that shows what I'd prefer. Can't test it now. Gerd roadspeed-v1.patch <http://gis.19327.n5.nabble.com/file/n5793644/roadspeed-v1.patch> GerdP wrote
WanMil wrote
I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem. hmm, is it possible that this line has no effect?
Please try something like GType typeCopy = new GType(type);
Gerd
-- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793644.html Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi, I haven't tested your patch. Copying the GType before postConvertRules() is required - that's a must to change. The strange thing is that I could reproduce the problem with r2814 (which is the version before merging the reduce-limits-branch). So the bug is in there for a long time and should have nothing to do with manipulating the GType objects. My personal guess is that it's a problem in writing the img format. But that's only a very big guess... WanMil
Hi,
attached is a patch that shows what I'd prefer. Can't test it now.
Gerd roadspeed-v1.patch <http://gis.19327.n5.nabble.com/file/n5793644/roadspeed-v1.patch>
GerdP wrote
WanMil wrote
I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem. hmm, is it possible that this line has no effect?
Please try something like GType typeCopy = new GType(type);
Gerd
-- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793644.html Sent from the Mkgmap Development mailing list archive at Nabble.com. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi, okay, maybe one of Steve's recent findings regarding NOD format will help. Gerd WanMil wrote
Hi,
I haven't tested your patch. Copying the GType before postConvertRules() is required - that's a must to change.
The strange thing is that I could reproduce the problem with r2814 (which is the version before merging the reduce-limits-branch). So the bug is in there for a long time and should have nothing to do with manipulating the GType objects.
My personal guess is that it's a problem in writing the img format. But that's only a very big guess...
WanMil
Hi,
attached is a patch that shows what I'd prefer. Can't test it now.
Gerd roadspeed-v1.patch <http://gis.19327.n5.nabble.com/file/n5793644/roadspeed-v1.patch>
GerdP wrote
WanMil wrote
I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem. hmm, is it possible that this line has no effect?
Please try something like GType typeCopy = new GType(type);
Gerd
-- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793644.html Sent from the Mkgmap Development mailing list archive at Nabble.com. _______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
_______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793647.html Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi all, I've committed r2979 with the roadspeed-v1.patch. It fixes the reported problem, at least MapSource calculates a reasonable travel time again. GPSMapEdit still shows weird values, so I assume that there are differences in the img parsing algos which explain that. I'd like to do the change regarding copies of GType after the merge of the high-prec-coord branch. Gerd
Date: Sun, 19 Jan 2014 21:41:52 +0100 From: wmgcnfg@web.de To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Weird road speed
Hi,
I haven't tested your patch. Copying the GType before postConvertRules() is required - that's a must to change.
The strange thing is that I could reproduce the problem with r2814 (which is the version before merging the reduce-limits-branch). So the bug is in there for a long time and should have nothing to do with manipulating the GType objects.
My personal guess is that it's a problem in writing the img format. But that's only a very big guess...
WanMil
Hi,
attached is a patch that shows what I'd prefer. Can't test it now.
Gerd roadspeed-v1.patch <http://gis.19327.n5.nabble.com/file/n5793644/roadspeed-v1.patch>
GerdP wrote
WanMil wrote
I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem. hmm, is it possible that this line has no effect?
Please try something like GType typeCopy = new GType(type);
Gerd
-- View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793644.html Sent from the Mkgmap Development mailing list archive at Nabble.com. _______________________________________________ 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

Hi Manfred, Thanks for the quick feedback :-) I think GPSMapEdit has problems with small maps produced by mkgmap. It often claims that the map is not routable. It seems to be related to the existence of route restrictions in the data, but that is just a guess. Gerd From: ManneB@gmx.net To: mkgmap-dev@lists.mkgmap.org.uk Date: Mon, 20 Jan 2014 06:47:10 +0100 Subject: Re: [mkgmap-dev] Weird road speed Gerd, a quick test looks ok for me. The values in DPSMapEdit seem to be ok. Thank you very much Manfred Gesendet: Montag, 20. Januar 2014 um 05:15 Uhr Von: "Gerd Petermann" <gpetermann_muenchen@hotmail.com> An: "mkgmap-dev@lists.mkgmap.org.uk" <mkgmap-dev@lists.mkgmap.org.uk> Betreff: Re: [mkgmap-dev] Weird road speed Hi all, I've committed r2979 with the roadspeed-v1.patch. It fixes the reported problem, at least MapSource calculates a reasonable travel time again. GPSMapEdit still shows weird values, so I assume that there are differences in the img parsing algos which explain that. I'd like to do the change regarding copies of GType after the merge of the high-prec-coord branch. Gerd
Date: Sun, 19 Jan 2014 21:41:52 +0100
From: wmgcnfg@web.de
To: mkgmap-dev@lists.mkgmap.org.uk
Subject: Re: [mkgmap-dev] Weird road speed
Hi,
I haven't tested your patch. Copying the GType before postConvertRules()
is required - that's a must to change.
The strange thing is that I could reproduce the problem with r2814
(which is the version before merging the reduce-limits-branch).
So the bug is in there for a long time and should have nothing to do
with manipulating the GType objects.
My personal guess is that it's a problem in writing the img format. But
that's only a very big guess...
WanMil
Hi,
attached is a patch that shows what I'd prefer. Can't test it now.
Gerd
roadspeed-v1.patch
<http://gis.19327.n5.nabble.com/file/n5793644/roadspeed-v1.patch>
GerdP wrote
WanMil wrote
I added
type = new GType(type);
at line 202 but this didn't change the overall result. So it seems not
to be the only problem.
hmm, is it possible that this line has no effect?
Please try something like
GType typeCopy = new GType(type);
Gerd
--
View this message in context: http://gis.19327.n5.nabble.com/Weird-road-speed-tp5793614p5793644.html
Sent from the Mkgmap Development mailing list archive at Nabble.com.
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
_______________________________________________ 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

Hi Gerd,
I've committed r2979 with the roadspeed-v1.patch.
I confirm, that now speeds look correctly. I don't think that using maxspeed for road speed is a good solution but processing is done correctly. Thanks Gerd.
It fixes the reported problem, at least MapSource calculates a reasonable travel time again.
Mapsource has own speed table for roads, which can be configured in options. I'm not sure if/how it use speed values form img. -- Best regards, Andrzej

Hi WanMil,
I can confirm that way 227105752 seems to get a wrong road speed when using your sample data. ("seems" because that's what GMapEdit tells me - there is no guarantee that there isn't a bug in GMapEdit)
As I have written i have done simulation in nuvi and this has confirmed that speed is wrong. In my example nuvi simulated 130kph, which is far too much for class 4, as it should be. Way 227105752 was an example for testing, but there are many more speed errors. It looks like mkgmap:road-speed-class is computed for a way and then applied to next one. -- Best regards, Andrzej

On 19/01/14 20:06, WanMil wrote:
@Gerd: StyledConverter.postConvertRules can change the road speed in the type. But this hasn't been copied before so I guess it's changing the global type of the rule. Can you check that? I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem.
The way I see it is that the GType is simply a representation of the type declaration in a rule. It is static and should not be modified or copied per way. The Converter converts Way -> MapRoad The rules produce a Gtype and a set of variables, V (that we happen to implement by adding mkgmap:* tags to the way). You use the GType and V to initialise the MapRoad. So to override the road_speed should be done in addRoadWithoutLoops() where it is currently initialised directly from the GType. ..Steve

Hi Steve, I agree that the GType should not be copied, I never felt happy with it. It is probably better to create a new Class like ConvertedRoad which extends Way and contains some exra fields like speed and class which are modified in StyledConverter. The RoadMerger also uses something like this. Gerd
Date: Sun, 19 Jan 2014 21:38:12 +0000 From: steve@parabola.me.uk To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Weird road speed
On 19/01/14 20:06, WanMil wrote:
@Gerd: StyledConverter.postConvertRules can change the road speed in the type. But this hasn't been copied before so I guess it's changing the global type of the rule. Can you check that? I added type = new GType(type); at line 202 but this didn't change the overall result. So it seems not to be the only problem.
The way I see it is that the GType is simply a representation of the type declaration in a rule. It is static and should not be modified or copied per way.
The Converter converts Way -> MapRoad
The rules produce a Gtype and a set of variables, V (that we happen to implement by adding mkgmap:* tags to the way).
You use the GType and V to initialise the MapRoad.
So to override the road_speed should be done in addRoadWithoutLoops() where it is currently initialised directly from the GType.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (6)
-
Andrzej Popowski
-
Gerd Petermann
-
GerdP
-
Manfred Brenneisen
-
Steve Ratcliffe
-
WanMil