This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch master in repository mkgmap-splitter.
commit 514e9688f1538ffa39cef7c95eaab32cdecbde8f Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Mon Jun 1 09:12:52 2015 +0200 Imported Upstream version 0.0.0+svn423 --- doc/splitter.1 | 9 ++++++++ doc/splitter.1.xml | 15 +++++++++++++ resources/splitter-version.properties | 4 ++-- src/uk/me/parabola/splitter/Main.java | 23 ++++++++++++++----- .../me/parabola/splitter/ProblemListProcessor.java | 26 ++++++++++++++++++---- .../me/parabola/splitter/args/SplitterParams.java | 6 +++++ 6 files changed, 72 insertions(+), 11 deletions(-) diff --git a/doc/splitter.1 b/doc/splitter.1 index 2920cdc..4092458 100644 --- a/doc/splitter.1 +++ b/doc/splitter.1 @@ -116,6 +116,15 @@ The o5m format is faster to read, but requires more space on the disk. There are a number of options to fine tune things that you might want to try. .TP +\*(T<\fB\-\-wanted\-admin\-level=\fR\*(T>\fIint\fR +Specifies the lowest admin_level value of boundary relations that +should be kept complete. Used to filter boundary relations for +problem-list processing. The default value 5 means that +boundary relations are kept complete when the admin_level is +5 or higher (5..11). +The parameter is ignored if \*(T<\fB\-\-keep\-complete=false\fR\*(T>. +Default: 5 +.TP \*(T<\fB\-\-boundary\-tags=\fR\*(T>\fIstring\fR A comma separated list of tag values for relations. Used to filter multipolygon and boundary relations for diff --git a/doc/splitter.1.xml b/doc/splitter.1.xml index 53789ba..e570b2a 100644 --- a/doc/splitter.1.xml +++ b/doc/splitter.1.xml @@ -146,6 +146,21 @@ JAVA_OPTS="<replaceable>-Xmx512m</replaceable>" <command>mkgmap-splitter</comman <variablelist> <varlistentry> + <term><option>--wanted-admin-level=<replaceable>string</replaceable></option></term> + <listitem> + <para> + Specifies the lowest admin_level value of boundary relations that + should be kept complete. Used to filter boundary relations for + problem-list processing. The default value 5 means that + boundary relations are kept complete when the admin_level is + 5 or higher (5..11). + The parameter is ignored if <option>--keep-complete=false</option>. + Default: 5 + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>--boundary-tags=<replaceable>string</replaceable></option></term> <listitem> <para> diff --git a/resources/splitter-version.properties b/resources/splitter-version.properties index 1d1c589..b3dd098 100644 --- a/resources/splitter-version.properties +++ b/resources/splitter-version.properties @@ -1,2 +1,2 @@ -svn.version: 421 -build.timestamp: 2015-01-10T20:01:10+0000 +svn.version: 423 +build.timestamp: 2015-05-22T08:27:25+0100 diff --git a/src/uk/me/parabola/splitter/Main.java b/src/uk/me/parabola/splitter/Main.java index 3d17514..0e983dc 100644 --- a/src/uk/me/parabola/splitter/Main.java +++ b/src/uk/me/parabola/splitter/Main.java @@ -121,6 +121,9 @@ public class Main { private boolean keepComplete; private String problemReport; + + // option for fine tuning the keep-complete processing + private int wantedAdminLevel; private String[] boundaryTags; @@ -444,7 +447,7 @@ public class Main { overlapAmount = Integer.valueOf(overlap); } catch (NumberFormatException e){ - throw new IllegalArgumentException("Error: --overlap=" + overlap + " is not is not a valid option."); + throw new IllegalArgumentException("--overlap=" + overlap + " is not is not a valid option."); } } problemReport = params.getProblemReport(); @@ -453,7 +456,16 @@ public class Main { Pattern csvSplitter = Pattern.compile(Pattern.quote(",")); boundaryTags = csvSplitter.split(boundaryTagsParm); } - + + if (keepComplete){ + String wantedAdminLevelString = params.getWantedAdminLevel(); + try { + wantedAdminLevel = Integer.valueOf(wantedAdminLevelString); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("--admin-level=" + wantedAdminLevelString + " is not is not a valid option."); + } + } + // plausibility checks and default handling if (keepComplete){ if (fileNameList.size() > 1){ @@ -500,7 +512,7 @@ public class Main { File f = new File(polygonFile); if (!f.exists()){ - throw new IllegalArgumentException("Error: polygon file doesn't exist: " + polygonFile); + throw new IllegalArgumentException("polygon file doesn't exist: " + polygonFile); } PolygonFileReader polyReader = new PolygonFileReader(f); java.awt.geom.Area polygonInDegrees = polyReader.loadPolygon(); @@ -543,14 +555,14 @@ public class Main { } stopAfter = params.getStopAfter(); if (Arrays.asList("split", "gen-problem-list" , "handle-problem-list", "dist").contains(stopAfter) == false){ - throw new IllegalArgumentException("Error: the --stop-after parameter must be either split, gen-problem-list, handle-problem-list, or dist."); + throw new IllegalArgumentException("the --stop-after parameter must be either split, gen-problem-list, handle-problem-list, or dist."); } precompSeaDir = params.getPrecompSea(); if (precompSeaDir != null){ File dir = new File (precompSeaDir); if (dir.exists() == false || dir.canRead() == false){ - throw new IllegalArgumentException("Error: precomp-sea directory doesn't exist or is not readable: " + precompSeaDir); + throw new IllegalArgumentException("precomp-sea directory doesn't exist or is not readable: " + precompSeaDir); } } if (polygons.isEmpty() == false && numTiles > 0){ @@ -712,6 +724,7 @@ public class Main { ProblemListProcessor processor = new ProblemListProcessor( dataStorer, writerOffset, numWritersThisPass, problemWaysThisPart, problemRelsThisPart, oneTileOnlyRels, boundaryTags); + processor.setWantedAdminLevel(wantedAdminLevel); boolean done = false; while (!done){ diff --git a/src/uk/me/parabola/splitter/ProblemListProcessor.java b/src/uk/me/parabola/splitter/ProblemListProcessor.java index 69fcdcf..2b4e0fb 100644 --- a/src/uk/me/parabola/splitter/ProblemListProcessor.java +++ b/src/uk/me/parabola/splitter/ProblemListProcessor.java @@ -57,7 +57,7 @@ class ProblemListProcessor extends AbstractMapProcessor { private boolean isFirstPass; private boolean isLastPass; private WriterIndex writerIndex; - + private final HashSet<String> wantedBoundaryAdminLevels = new HashSet<>(); private final HashSet<String> wantedBoundaryTagValues; @@ -89,12 +89,21 @@ class ProblemListProcessor extends AbstractMapProcessor { this.problemRels = problemRels; this.oneTileOnlyRels = oneTileOnlyRels; if (boundaryTagList != null && boundaryTagList.length > 0) - wantedBoundaryTagValues = new HashSet<String>(Arrays.asList(boundaryTagList)); + wantedBoundaryTagValues = new HashSet<>(Arrays.asList(boundaryTagList)); else wantedBoundaryTagValues = null; + setWantedAdminLevel(5); } - + public void setWantedAdminLevel(int adminLevel) { + int min, max = 11; + min = Math.max(2, adminLevel); + wantedBoundaryAdminLevels.clear(); + for (int i = min; i <= max; i++){ + wantedBoundaryAdminLevels.add(Integer.toString(i)); + } + } + @Override public boolean skipTags() { if (phase == PHASE1_NODES_AND_WAYS) @@ -218,7 +227,7 @@ class ProblemListProcessor extends AbstractMapProcessor { } } // default exclude list for boundary tag - private final static HashSet<String> unwantedBoundaryTagValues = new HashSet<String>( + private final static HashSet<String> unwantedBoundaryTagValues = new HashSet<>( Arrays.asList("administrative", "postal_code", "political")); @Override @@ -230,6 +239,7 @@ class ProblemListProcessor extends AbstractMapProcessor { boolean hasBoundaryTag = false; boolean isWantedBoundary = (wantedBoundaryTagValues == null) ? true:false; Iterator<Element.Tag> tags = rel.tagsIterator(); + String admin_level = null; while(tags.hasNext()) { Element.Tag t = tags.next(); if ("type".equals(t.key)) { @@ -248,6 +258,8 @@ class ProblemListProcessor extends AbstractMapProcessor { if (unwantedBoundaryTagValues.contains(t.value)) isWantedBoundary = false; } + } else if ("admin_level".equals(t.key)){ + admin_level = t.value; } if (useThis) @@ -255,6 +267,10 @@ class ProblemListProcessor extends AbstractMapProcessor { } if (isMPRelType && (isWantedBoundary || hasBoundaryTag == false)) useThis = true; + else if (isMPRelType && hasBoundaryTag && admin_level != null){ + if (wantedBoundaryAdminLevels.contains(admin_level)) + useThis = true; + } if (!useThis){ return; } @@ -373,4 +389,6 @@ class ProblemListProcessor extends AbstractMapProcessor { // but it is difficult to detect these cases. return writerCombis.cardinality() > 1; } + + } diff --git a/src/uk/me/parabola/splitter/args/SplitterParams.java b/src/uk/me/parabola/splitter/args/SplitterParams.java index 318410b..c17bc8d 100644 --- a/src/uk/me/parabola/splitter/args/SplitterParams.java +++ b/src/uk/me/parabola/splitter/args/SplitterParams.java @@ -106,6 +106,12 @@ public interface SplitterParams { + "Used to filter multipolygon and boundary relations for problem-list processing.") String getBoundaryTags(); + @Option(defaultValue="5", description = "The lowest admin_level value that should be kept complete. Reasonable values are 2 .. 11." + + "Used to filter boundary relations for problem-list processing. Ignored when keep-complete is false.") + String getWantedAdminLevel(); + + + @Option(defaultValue = "200000", description = "Search limit in split algo. Higher values may find better splits, but will take longer.") int getSearchLimit(); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mkgmap-splitter.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel