On Sat, Apr 16, 2011 at 12:27:30PM +0300, Marko Mäkelä wrote:
There is an option to disable the processing of turn restriction
relations (--ignore-turn-restrictions), but no option to disable the
processing of multipolygon relations. The attached patch introduces
--ignore-builtin-relations, which disables the built-in processing of
all relations (currently, type={boundary,multipolygon,restiction}).
This patch reduces the processing time of my simple map layers from 2.5
minutes to 2 minutes.
Here is a corrected, tested version of the patch. Meanwhile, it takes
2.5 minutes to process --style=routes-bus on finland.osm.pbf with this
patch applied.
OK to commit?
Marko
Index: src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java (revision 2001)
+++ src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java (working copy)
@@ -67,6 +67,7 @@ public class ElementSaver {
private int maxLon = Utils.toMapUnit(-180.0);
// Options
+ private final boolean ignoreBuiltinRelations;
private final boolean ignoreTurnRestrictions;
private final Double minimumArcLength;
@@ -94,6 +95,7 @@ public class ElementSaver {
else
minimumArcLength = null;
+ ignoreBuiltinRelations = args.getProperty("ignore-builtin-relations", false);
ignoreTurnRestrictions = args.getProperty("ignore-turn-restrictions", false);
}
@@ -145,9 +147,10 @@ public class ElementSaver {
* @param rel The osm relation.
*/
public void addRelation(Relation rel) {
- String type = rel.getTag("type");
- if (type != null) {
- if ("multipolygon".equals(type) || "boundary".equals(type)) {
+ if (!ignoreBuiltinRelations) {
+ String type = rel.getTag("type");
+ if (type == null) {
+ } else if ("multipolygon".equals(type) || "boundary".equals(type)) {
rel = createMultiPolyRelation(rel);
} else if("restriction".equals(type)) {
if (ignoreTurnRestrictions)
Index: resources/help/en/options
===================================================================
--- resources/help/en/options (revision 2001)
+++ resources/help/en/options (working copy)
@@ -252,6 +252,9 @@ Miscellaneous options:
--ignore-maxspeeds
When reading OSM files, ignore any "maxspeed" tags.
+--ignore-builtin-relations
+ When reading OSM files, skip the built-in processing of relations.
+
--ignore-turn-restrictions
When reading OSM files, ignore any "restriction" relations.
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev