Hi all,
attached is version 4 of the patch, based on the problem-list branch.
WanMil and I found out that it reduces the size of splitter output files
(and run time) quite nice, but it also sometimes adds boundary relations
that were not output with r263, which in
turn changes the output of mkgmap a little bit.
We are not sure if this is acceptable for all, so please try this.
Gerd
> Date: Mon, 17 Dec 2012 06:41:40 -0800
> From: [email protected]
> To: [email protected]
> Subject: Re: [mkgmap-dev] splitter: relations to be checked with
> keep-complete=true
>
> GerdP wrote
> > Attached is a patch for r263 that tries to implement WanMils proposals.
>
> Stupid error: the patch did not filter type=route relations because route is
> contained in through_route.
> Here is the corrected version.
> limit_relation_types_v2.patch
> <http://gis.19327.n5.nabble.com/file/n5740697/limit_relation_types_v2.patch>
>
> The amount of removed data is quite big, so it would be nice if that still
> is all that we need
> for mkgmap.
>
> Ciao,
> Gerd
>
>
>
> --
> View this message in context:
> http://gis.19327.n5.nabble.com/splitter-relations-to-be-checked-with-keep-complete-true-tp5740576p5740697.html
> Sent from the Mkgmap Development mailing list archive at Nabble.com.
> _______________________________________________
> mkgmap-dev mailing list
> [email protected]
> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: src/uk/me/parabola/splitter/MultiTileProcessor.java
===================================================================
--- src/uk/me/parabola/splitter/MultiTileProcessor.java (revision 267)
+++ src/uk/me/parabola/splitter/MultiTileProcessor.java (working copy)
@@ -193,7 +193,7 @@
// add all ways and nodes of problem rels so that we collect the coordinates
markProblemMembers();
// we want to see the parent rels, but not all children of all parents
- markParentRels();
+ //markParentRels();
// free memory for rels that are not causing any trouble
Iterator<Entry<Long, MTRelation>> it = relMap.entrySet().iterator();
while (it.hasNext()) {
@@ -323,6 +323,7 @@
/**
* Mark the parents of problem relations as problem relations.
*/
+ /*
private void markParentRels(){
while (true){
boolean changed = false;
@@ -346,7 +347,7 @@
return;
}
}
-
+ */
/**
* Calculate the writers for each relation based on the
* nodes and ways.
@@ -919,7 +920,7 @@
for (int i = 0; i<numMembers; i++){
Member mem = rel.getMembers().get(i);
memRefs[i] = mem.getRef();
- memRoles[i] = mem.getRole();
+ memRoles[i] = mem.getRole().intern();
if ("node".equals(mem.getType())){
memTypes[i] = MEM_NODE_TYPE;
flags |= HAS_NODES;
Index: src/uk/me/parabola/splitter/ProblemListProcessor.java
===================================================================
--- src/uk/me/parabola/splitter/ProblemListProcessor.java (revision 267)
+++ src/uk/me/parabola/splitter/ProblemListProcessor.java (working copy)
@@ -19,6 +19,7 @@
import java.awt.Rectangle;
import java.util.BitSet;
+import java.util.Iterator;
/**
* Find ways and relations that will be incomplete.
@@ -83,7 +84,8 @@
@Override
public boolean skipTags() {
- return true;
+ //return true;
+ return false;
}
@Override
@@ -174,9 +176,27 @@
}
}
+ private final static String[] WANTED_RELS = {"restriction", "multipolygon" ,"through_route"};
@Override
public void processRelation(Relation rel) {
//BitSet writerSet = new BitSet();
+ boolean useThis = false;
+ Iterator<Element.Tag> tags = rel.tagsIterator();
+ while(tags.hasNext()) {
+ Element.Tag t = tags.next();
+ if ("type".equals(t.key)) {
+ for (String wanted: WANTED_RELS){
+ if (wanted.equals((t.value))){
+ useThis = true;
+ break;
+ }
+ }
+ }
+ if (useThis)
+ break;
+ }
+ if (!useThis)
+ return;
writerSet.clear();
Integer relWriterIdx;
if (!isFirstPass){
Index: src/uk/me/parabola/splitter/SplitProcessor.java
===================================================================
--- src/uk/me/parabola/splitter/SplitProcessor.java (revision 267)
+++ src/uk/me/parabola/splitter/SplitProcessor.java (working copy)
@@ -108,6 +108,7 @@
@Override
public void processWay(Way w) {
+ currentWayAreaSet.clear();
int multiTileWriterIdx = (wayWriterMap != null) ? wayWriterMap.getSeq(w.getId()): WriterDictionaryInt.UNASSIGNED;
if (multiTileWriterIdx != WriterDictionaryInt.UNASSIGNED){
BitSet cl = dataStorer.getMultiTileWriterDictionary().getBitSet(multiTileWriterIdx);
@@ -133,30 +134,30 @@
}
}
}
- if (!currentWayAreaSet.isEmpty()){
- // store these areas in ways map
- short idx = writerDictionary.translate(currentWayAreaSet);
- ways.put(w.getId(), idx);
- ++countWays;
- if (countWays % 1000000 == 0){
- System.out.println("MAP occupancy: " + Utils.format(countWays) + ", number of area dictionary entries: " + writerDictionary.size() + " of " + ((1<<16) - 1));
- ways.stats(0);
- }
+ }
+ if (!currentWayAreaSet.isEmpty()){
+ // store these areas in ways map
+ short idx = writerDictionary.translate(currentWayAreaSet);
+ ways.put(w.getId(), idx);
+ ++countWays;
+ if (countWays % 1000000 == 0){
+ System.out.println("MAP occupancy: " + Utils.format(countWays) + ", number of area dictionary entries: " + writerDictionary.size() + " of " + ((1<<16) - 1));
+ ways.stats(0);
}
}
try {
writeWay(w);
- currentWayAreaSet.clear();
} catch (IOException e) {
throw new RuntimeException("failed to write way " + w.getId(), e);
-
}
}
@Override
public void processRelation(Relation rel) {
+ currentRelAreaSet.clear();
int multiTileWriterIdx = (relWriterMap != null) ? relWriterMap.getSeq(rel.getId()): WriterDictionaryInt.UNASSIGNED;
if (multiTileWriterIdx != WriterDictionaryInt.UNASSIGNED){
+
BitSet cl = dataStorer.getMultiTileWriterDictionary().getBitSet(multiTileWriterIdx);
try {
// set only active writer bits
@@ -165,7 +166,6 @@
}
writeRelation(rel);
//System.out.println("added rel: " + r.getId());
- currentRelAreaSet.clear();
} catch (IOException e) {
throw new RuntimeException("failed to write relation " + rel.getId(),
e);
@@ -204,7 +204,6 @@
}
writeRelation(rel);
- currentRelAreaSet.clear();
} catch (IOException e) {
throw new RuntimeException("failed to write relation " + rel.getId(),
e);
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev