Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi Marco, > I guess "commit" means putting the patch in the mainstream mkgmap. Well if > you do that and I can download the new version of mkgmap with the -- > ignore-maxspeed switch, I'll test it immediately with my style and I'll send > back the results (mainly the changes in routing and ETA). I don't know what you mean by "mainstream" but I shall commit it to the main development branch anyway along with another little patch. Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi, I guess "commit" means putting the patch in the mainstream mkgmap. Well if you do that and I can download the new version of mkgmap with the -- ignore-maxspeed switch, I'll test it immediately with my style and I'll send back the results (mainly the changes in routing and ETA). Marco. --- Gio 21/5/09, Mark Burton ha scritto: > Da: Mark Burton > Oggetto: Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset > A: mkgmap-dev@lists.mkgmap.org.uk > Data: Giovedì 21 maggio 2009, 21:29 > > > From the various posts on this topic, I get the impression > that there > is much more to this business than just zapping the > maxspeed tags. > > Why don't those people who care about this stuff work out > what is really > required and either come up with a concrete proposal as to > how it > should be done, or even better still, come up with a patch > that does it? > > In the meantime, shall I commit this little option? > > Cheers, > > Mark > ___ > 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: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
From the various posts on this topic, I get the impression that there is much more to this business than just zapping the maxspeed tags. Why don't those people who care about this stuff work out what is really required and either come up with a concrete proposal as to how it should be done, or even better still, come up with a patch that does it? In the meantime, shall I commit this little option? Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi Thilo, > So if you like to integrate the switch for > the maxspeed handling into the trunk I will be happy, but I also > understand that you might not want mkgmap to be cluttered with lots of > "special options". Well, I don't have a problem with lots of options so I am happy to commit that patch if people are agreed that it's useful. Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi Greg Troxel 1st: I do not know very well how to keep the answer in the same thread... anyway, I do not think there is a simple way to hard-code a proper speed of a road that is right for all cases (expecially if it is indifferentiated for all highway types). I can speed on a city road at 60 km/h during night and 15 km/h during day (yes, 15 km/h is the average speed in Rome, as measured by the public transportation company). Maybe only real time traffic information systems can work well in such messy cases. And of course I can just imagine the endless discussions for each road about the right value to give to an "average_speed" tag... Much better would be to automatically calculate an average_speed tag by using all information the OSM DB already have: the highway type, the maxspeed tag, the number of crosses per kilometer, the curves (radius and frequency) and also the available GPX real speed data. For now I think much simpler: a tertiary road in the countryside, maybe full of curves, slopes, narrow points, you might have a "law limit" of 90 but you will never go to 90. I'd say 60 average. In the same countryside, a primary road is wide, straight, has precedence over smaller roads, but the limit is still 90. I'd say you go 90 average. Back to the city: both tertiary and primary share a maxspeed of 50, then you go maybe at 40 on tertiary and only slighlly faster on primary. highway=tertiary & maxspeed>60 [... road_speed=3 ...] highway=tertiary & maxspeed<61 [... road_speed=2 ...] highway=primary & maxspeed>80 [... road_speed=5 ...] highway=primary & maxspeed>60 [... road_speed=4 ...] highway=primary & maxspeed<61 [... road_speed=3 ...] If you want I can post my style file (I'm still workin on it...). I think this speed differentiation would help the router to guess the right way and the right ETA both inside the city and outside. In Java, someone smarter could count crosses per kilometer or curve radius. Maybe next year... Ciao, Marco. ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Marco Certelli writes: > I just would like to keep control over the map generation. For > example: in Italy the maxspeed out of the city is 90km/h. It applies > to unclassified roads up to trunk roads (well, some trunks has 110 > km/h). > > I would like to code in the map in a way that a tertiary with 90km/h > speed limit gets road_speed 3 (i.e 60 km effective speed), while a > trunk with the same 90km/h limit gets road_speed 5 (i.e 90 km/h > effective speed). You can immagine for the secondary and primary. I think the real problem is that maxspeed being a legal maximum is just not the right concept for routing. In ma.us, the rule is that one's speed must be reasonable and proper, and if you are over the posted speed you are deemed not reasonable and proper. But you can't drive that speed if it's not safe. I gather in .it it's similar, but that it's reasonably common to have roads where driving the legal max is unsafe and therefore not allowed. Or are you talking about congestion that is so frequent that the typical experience is below max speed due to that, even though at 0530 you might be able to go maxspeed? > I looked at the source and you coded: if maxspeed>40 then road_speed=3 > > It means that in the Italian cities (limit=50) the average speed coded > in the map is 60km/h. It looks strange to me and carries to very > "optimistic" city ETA calculations (and maybe not optimal route > selection). What I think is needed is a new tag "typical_speed" that gives the speed at which traffic tends to move when it is not unusually congested. Something like the median actual speed over many samples spaced reasonably uniformly in time. This can be higher or lower than the limit - this morning on a road posted at 55 mph there was not a single car going less than 75 mph. It might be good to set road_speed to the highest value <= maxspeed, but this is really just kludging around the real problem of a good estimate. > Moreover, I sow other map makers (DE:All_in_one_Garmin_Map) making > maps including the maxspeed tag management in their styles (but maybe > they use a patched mkgmap). > > So, if it counts I do vote for the switch --ignore-maxspeed and I vote > to integrate the patch in the mainstream mkgmap (again, I'm not able > to compile the code). It sounds like moving the maxspeed => garmin speed tags rules out of java and into style files is the right thing to do, because then people can make their own ad hoc rules for road type and max speed to estimate the not-yet-present "typical_speed" tag value. But I think we should be clear that what we are doing is taking multiple kinds of data from the database and estimating properties that could be recorded but aren't yet. pgpn017hXinlJ.pgp Description: PGP signature ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi, and thaks for your answer. I'm not a developer so I really have some problem in applying the patch locally... I just would like to keep control over the map generation. For example: in Italy the maxspeed out of the city is 90km/h. It applies to unclassified roads up to trunk roads (well, some trunks has 110 km/h). I would like to code in the map in a way that a tertiary with 90km/h speed limit gets road_speed 3 (i.e 60 km effective speed), while a trunk with the same 90km/h limit gets road_speed 5 (i.e 90 km/h effective speed). You can immagine for the secondary and primary. I looked at the source and you coded: if maxspeed>40 then road_speed=3 It means that in the Italian cities (limit=50) the average speed coded in the map is 60km/h. It looks strange to me and carries to very "optimistic" city ETA calculations (and maybe not optimal route selection). Moreover, I sow other map makers (DE:All_in_one_Garmin_Map) making maps including the maxspeed tag management in their styles (but maybe they use a patched mkgmap). So, if it counts I do vote for the switch --ignore-maxspeed and I vote to integrate the patch in the mainstream mkgmap (again, I'm not able to compile the code). As you may have understood, I'm using Windo.%$&"/$£/$=)"(/$)"&)%$()"% Sorry, my PC crashed while I was writing Windo.=)/(/£%&(/&"/(&$"/=)"30/()/&89 Ciao, Marco. ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi Mark, It occurs to me that some people will want the maxspeed tag to override the speed code in the rules file (obviously, the person who wrote that code thought it was a good idea) but others, like Marco, would prefer not to have that feature. So, I guess, we need (yet another) option to control this behaviour. I attach a patch that does, essentially, the same thing as your patch with the addition that you can switch that behaviour on and off. Thank you for that patch. The patch I posted was intended to be applied locally if one wanted to remove that behaviour. With the state of mkgmap right now I think it is reasonable to hardcode such things as the maxspeed, because otherwise the style files will get overly complex and with the current syntax of the style files a lot of things can not be encoded at all (for example motorway exits, roundabouts etc.) For special "map- tuning" one will have to modify the mkgmap source. Which is probably even easier than coming up with highly complex style files to accomplish the same thing. So if you like to integrate the switch for the maxspeed handling into the trunk I will be happy, but I also understand that you might not want mkgmap to be cluttered with lots of "special options". Regards Thilo ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[PATCH v1] Re: [mkgmap-dev] maxspeed tag vs road_speed preset
Hi Thilo, > the relationship between the maxspeed tag and the road_speed is > hardcoded in mkgmap. This is reasonable in general, because otherwise > the style files had to be much larger to cover all the possible > road_speeds per road. But if you want to use the road_speed in a > creative way (say for a cycle map) this gets in the way. > > The evaluation of the maxspeed tag is implemented in src/uk/me/ > parabola/mkgmap/osmstyle/StyledConverter.java. The following patch > will remove it. It occurs to me that some people will want the maxspeed tag to override the speed code in the rules file (obviously, the person who wrote that code thought it was a good idea) but others, like Marco, would prefer not to have that feature. So, I guess, we need (yet another) option to control this behaviour. I attach a patch that does, essentially, the same thing as your patch with the addition that you can switch that behaviour on and off. Cheers, Mark diff --git a/resources/help/en/options b/resources/help/en/options index 348272e..4a85ef4 100644 --- a/resources/help/en/options +++ b/resources/help/en/options @@ -112,6 +112,9 @@ Misc options: Write a gmapsupp.img file that can be uploaded to a garmin in usb mode. +--ignore-maxspeeds + When reading OSM files, ignore any "maxspeed" tags. + --ignore-turn-restrictions When reading OSM files, ignore any "restriction" relations. diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java index 86c0cda..cc9f9cc 100644 --- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java +++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import uk.me.parabola.imgfmt.app.Area; @@ -95,6 +96,7 @@ public class StyledConverter implements OsmConverter { private final Rule nodeRules; private final Rule relationRules; + private boolean ignoreMaxspeeds; class AccessMapping { private final String type; @@ -128,13 +130,14 @@ public class StyledConverter implements OsmConverter { } }; - public StyledConverter(Style style, MapCollector collector) { + public StyledConverter(Style style, MapCollector collector, Properties props) { this.collector = collector; nameTagList = style.getNameTagList(); wayRules = style.getWayRules(); nodeRules = style.getNodeRules(); relationRules = style.getRelationRules(); + ignoreMaxspeeds = props.getProperty("ignore-maxspeeds") != null; LineAdder overlayAdder = style.getOverlays(lineAdder); if (overlayAdder != null) @@ -619,13 +622,15 @@ public class StyledConverter implements OsmConverter { road.setOneway(); } - // maxspeed attribute overrides default for road type - - String maxSpeed = way.getTag("maxspeed"); int speedIdx = -1; - - if(maxSpeed != null) - speedIdx = getSpeedIdx(maxSpeed); + if(!ignoreMaxspeeds) { + // maxspeed attribute overrides default for road type + String maxSpeed = way.getTag("maxspeed"); + if(maxSpeed != null) { +speedIdx = getSpeedIdx(maxSpeed); +log.info(debugWayName + " maxspeed=" + maxSpeed + ", speedIndex=" + speedIdx); + } + } road.setSpeed(speedIdx >= 0? speedIdx : gt.getRoadSpeed()); diff --git a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5MapDataSource.java b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5MapDataSource.java index def03cf..840cd8f 100644 --- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5MapDataSource.java +++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5MapDataSource.java @@ -120,7 +120,7 @@ public class Osm5MapDataSource extends OsmMapDataSource { style.applyOptionOverride(props); setStyle(style); - converter = new StyledConverter(style, mapper); + converter = new StyledConverter(style, mapper, props); } catch (SyntaxException e) { System.err.println("Error in style: " + e.getMessage()); throw new ExitException("Could not open style " + name); ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev