Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd Thinking about this a bit more, there are still some cases where adjacent shapes are next to cut-lines to get to holes (ie 3 or more lines at same cut-point) that might not be ordered correctly. I think it is possible to fix these by adding another sort structure. Starting on this, I didn't like some of my new awkward shape handling code and it has is a bug in the handling of the last element in the list - fixed in the tidy-up I've attached low-res-opt patch Ticker On Wed, 2021-06-02 at 14:58 +, Gerd Petermann wrote: > Hi Ticker, > > That seems to work better. I still see some error messages but those > are probably really invalid shapes produced by ShapeMerger. At least > I see that one point is visited more than twice and that should not > happen. > > Maybe you can add unit tests to test the error cases? > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Mittwoch, 2. Juni 2021 16:06 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > I've found and fixed some stupid mistakes - sorry for wasting your > time. > > Patch attached - works with your test case. > > Ticker > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-devIndex: src/uk/me/parabola/util/ShapeSplitter.java === --- src/uk/me/parabola/util/ShapeSplitter.java (revision 4755) +++ src/uk/me/parabola/util/ShapeSplitter.java (working copy) @@ -287,6 +287,10 @@ private boolean multSameLow; // lineInfo.sort(comparator) might set this + // following are for processAwkward... + private MergeCloseHelper forwardLine, backwardLine; + private int directionBalance; + private void logMsg(Object ... olist) { detectedProblems = true; log.warn(olist); @@ -411,12 +415,14 @@ // Multiple hole balloons from the same point // Balloon(s) that share the same point as dLoops boolean haveBalloons = false; - + // Duplicate dLoops in same direction can be removed / opposite direction cancel each other out. // Do this before Balloon processing as dLoop removal can make some problems go away. List newList = new ArrayList<>(lineInfo.size()); - MergeCloseHelper forwardLine = null, backwardLine = null, lastLine = null; - int directionBalance = 0; + MergeCloseHelper lastLine = null; + forwardLine = null; + backwardLine = null; + directionBalance = 0; boolean grouping = false; for (MergeCloseHelper thisLine : lineInfo) { if (lastLine != null) { @@ -424,40 +430,14 @@ thisLine.lowPoint == lastLine.lowPoint && thisLine.highPoint == lastLine.highPoint && Math.abs(thisLine.areaToLine) == Math.abs(lastLine.areaToLine); -if (grouping || sameAsLast) { - grouping = true; - if (lastLine.direction > 0) { - forwardLine = lastLine; - ++directionBalance; - } else { - backwardLine = lastLine; - --directionBalance; - } -} -if (!sameAsLast) { // flush previous - if (grouping) { - if (directionBalance > 0) - newList.add(forwardLine); - else if (directionBalance < 0) - newList.add(backwardLine); - directionBalance = 0; - grouping = false; - } else - newList.add(lastLine); -} +fixDups(newList, lastLine, sameAsLast, grouping); +grouping = sameAsLast; } lastLine = thisLine; if (thisLine.lowPoint == thisLine.highPoint) haveBalloons = true; } - // flush last - if (grouping) { - if (directionBalance > 0) -newList.add(forwardLine); - else if (directionBalance < 0) -newList.add(backwardLine); - } else - newList.add(lastLine); + fixDups(newList, lastLine, false, grouping); if (newList.size() < lineInfo.size()) { lineInfo.clear(); @@ -466,7 +446,7 @@ if (!haveBalloons) return; - + // Balloons will be sorted earlier than dLoops that share the same lowPoint, // but those that form a shape must be within a hole and those that form a hole must be within // a shape and so might need moving. @@ -486,29 +466,12 @@ for (MergeCloseHelper thisLine : lineInfo) { if (lastLine != null) { boolean sameAsLast = thisLine.lowPoint == lastLine.lowPoint; -if (grouping || sameAsLast) { - grouping = true; - if (lastLine.lowPoint != lastLine.highPoint) - dLoops.add(lastLine); - else if (lastLine.areaOrHole == 1) - shapes.add(lastLine); - else - holes.add(lastLine); -} -if (!sameAsLast) { - if (grouping) { - reordered |= fixOrder(newList, dLoops, shapes, holes); - grouping = false; - } else - newList.add(lastLine); -
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, That seems to work better. I still see some error messages but those are probably really invalid shapes produced by ShapeMerger. At least I see that one point is visited more than twice and that should not happen. Maybe you can add unit tests to test the error cases? Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Mittwoch, 2. Juni 2021 16:06 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I've found and fixed some stupid mistakes - sorry for wasting your time. Patch attached - works with your test case. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I've found and fixed some stupid mistakes - sorry for wasting your time. Patch attached - works with your test case. Ticker Index: src/uk/me/parabola/util/ShapeSplitter.java === --- src/uk/me/parabola/util/ShapeSplitter.java (revision 4753) +++ src/uk/me/parabola/util/ShapeSplitter.java (working copy) @@ -275,11 +275,23 @@ return pointsToPath2D(outputList, countVals); } -/* Dec16/Jan17. Ticker Berkin. New implementation for splitting shapes. +// Dec16/Jan17. Ticker Berkin. New implementation for splitting shapes and clipping -Eventually maybe can be used instead of some of the above and elsewhere -*/ + private boolean detectedProblems; + private List newLess, newMore; + private String gpxDirectory; + private long fullArea; + private List lineInfo; // for the side we are working on + private List> origList; // ditto + + private boolean multSameLow; // lineInfo.sort(comparator) might set this + + private void logMsg(Object ... olist) { + detectedProblems = true; + log.warn(olist); + } + /** * Service routine for processLineList. Processes a nested list of holes within a shape or * list of shapes within a hole. @@ -290,11 +302,8 @@ * @param endEnclosed point where starting line ends on dividing line. * @param addHolesToThis if not null, then called from a shape and subtract holes from it * otherwise new shapes within a hole. - * @param lineInfo list of lines. - * @param origList list of shapes to which we append new shapes. */ - private static int doLines(int startInx, int endEnclosed, MergeCloseHelper addHolesToThis, - List lineInfo, List> origList) { + private int doLines(int startInx, int endEnclosed, MergeCloseHelper addHolesToThis) { int inx = startInx; final boolean calledFromHole = addHolesToThis == null; while (inx < lineInfo.size()) { @@ -304,9 +313,9 @@ if (thisLine.lowPoint == endEnclosed && thisLine.highPoint == endEnclosed) // consider carefully if (calledFromHole == (thisLine.areaOrHole == -1)) break; // stop if same type - inx = doLines(inx+1, thisLine.highPoint, calledFromHole ? thisLine : null, lineInfo, origList); + inx = doLines(inx+1, thisLine.highPoint, calledFromHole ? thisLine : null); if (calledFromHole) // handling list of shapes -thisLine.closeAppend(origList, true); +thisLine.closeAppend(true); else // handling list of holes addHolesToThis.addHole(thisLine); } @@ -317,17 +326,17 @@ * Service routine for splitShape. Takes list of lines and appends distinct shapes * @param lineInfo list of lines that start and end on the dividing line (or orig startPoint) * @param origList list of shapes to which we append new shapes formed from above - * @param fullArea of orig polygon. used for sign and handling of last line segment */ - private static int processLineList(List lineInfo, List> origList, long fullArea) { - int errorCount = 0; + private void processLineList(List lineInfo, List> origList) { + this.lineInfo = lineInfo; + this.origList = origList; if (origList == null) // never wanted this side - return errorCount; + return; MergeCloseHelper firstLine = lineInfo.get(0); if (lineInfo.size() == 1) { // single shape that never crossed line if (!firstLine.points.isEmpty()) // all on this side -firstLine.closeAppend(origList, false); - return errorCount; +firstLine.closeAppend(false); + return; } // look at last item in list of lines MergeCloseHelper lastLine = lineInfo.get(lineInfo.size()-1); @@ -335,14 +344,14 @@ lineInfo.remove(lineInfo.size()-1); else { // ended up on this side and must have crossed the line // so first element is really the end of the last - lastLine.combineFirstIntoLast(firstLine, fullArea); + lastLine.combineFirstIntoLast(firstLine); lineInfo.remove(0); firstLine = lineInfo.get(0); } if (lineInfo.size() == 1) { // simple poly that crossed once and back firstLine.setMoreInfo(0); - firstLine.closeAppend(origList, true); - return errorCount; + firstLine.closeAppend(true); + return; } // Above were the simple cases - probably 99% of calls. @@ -358,7 +367,6 @@ // check and set any missing directions based on signs of full/area boolean someDirectionsNotSet = false; int areaDirection = 0; - String diagMsg = ""; for (MergeCloseHelper thisLine : lineInfo) { thisLine.setMoreInfo(fullAreaSign); if (thisLine.direction == 0) @@ -368,78 +376,208 @@ if (areaDirection == 0) areaDirection = tmpAreaDirection; else if (areaDirection != tmpAreaDirection) - diagMsg += "Direction/Area conflict."; + logMsg("Direction/Area conflict", fullAreaSign, areaDirection, tmpAreaDirection); } } if (someDirectionsNotSet) { if (areaDirection == 0) -diagMsg += "Cant deduce direction/Area mapping."; +logMsg("Can't deduce direction/Area mapping", fullAreaSign); else
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I was beginning to suspect this - there were 2 very close cut-lines which is why I thought coords were not behaving. I've reproduced with the .osm and am investigating Ticker On Wed, 2021-06-02 at 09:50 +, Gerd Petermann wrote: > Hi Ticker, > > yes, was with splitShapeFix_5_lowRes.patch > I've just noticed that s_3 and s_4 were from a different split. > The shape was the result of various steps with "too small island > removal" and "cut again after full merge". > > Maybe you can reproduce with the attached file. I've loaded the gpx > into JOSM, fixed the duplicated points and used Shift+J (join > overlapping areas) > > Gerd > > > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Mittwoch, 2. Juni 2021 11:23 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > I see what you mean. Is this with splitShaeFix_5_lowRes.patch? > I'll investigate. Is there an OSM file I can run with? > > Ticker > > On Wed, 2021-06-02 at 06:32 +, Gerd Petermann wrote: > > Hi Ticker, > > > > please check > > https://files.mkgmap.org.uk/download/509/special-v5.zip > > > > Can you tell me why ShapeSplitter drops some points, e.g the one > > near > > 68.2669706, 15.1206053 without complaining? > > None of the points in the original data is visited more than twice > > and all highprec equal points are unique. > > > > I'm working on an improvement to make the connecting lines shorter, > > but I don't see yet how I can avoid to have connecting lines like > > that. > > > > Gerd > > > > ____________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 1. Juni 2021 17:18 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > I've added code to deal with some variants of the case as described > > - > > I > > hope this will be enough to cope with more complex shapes generated > > by > > ShapeMerger. > > > > There might be a bit more I can do without having to resort to more > > complex geometry analysis if it still gives problems. > > > > I've also restructured it a bit. > > > > Patch attached based on low-res-opt. Trunk version will be the same > > (but the patch would be different) > > > > Ticker > > > > On Mon, 2021-05-31 at 17:12 +0100, Ticker Berkin wrote: > > > Hi Gerd > > > > > > shapeSplitter will have problems (ie get it wrong some of the > > > time) > > > where there are in/out lines to a hole that share the same cut > > > point > > > as > > > a line that is the boundary between a shape and hole; could be > > > many > > > holes (or shapes) and many lines. The simple sort/dedupe I was > > > doing > > > isn't adequate. I'll come up with something better tomorrow. > > > > > > Ticker > > > > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I'm thinking this is a problem with high-precision points and the coordPool Ticker On Wed, 2021-06-02 at 10:23 +0100, Ticker Berkin wrote: > Hi Gerd > > I see what you mean. Is this with splitShaeFix_5_lowRes.patch? > I'll investigate. Is there an OSM file I can run with? > > Ticker > > On Wed, 2021-06-02 at 06:32 +, Gerd Petermann wrote: > > Hi Ticker, > > > > please check > > https://files.mkgmap.org.uk/download/509/special-v5.zip > > > > Can you tell me why ShapeSplitter drops some points, e.g the one > > near > > 68.2669706, 15.1206053 without complaining? > > None of the points in the original data is visited more than twice > > and all highprec equal points are unique. > > > > I'm working on an improvement to make the connecting lines shorter, > > but I don't see yet how I can avoid to have connecting lines like > > that. > > > > Gerd > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 1. Juni 2021 17:18 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > I've added code to deal with some variants of the case as described > > - > > I > > hope this will be enough to cope with more complex shapes generated > > by > > ShapeMerger. > > > > There might be a bit more I can do without having to resort to more > > complex geometry analysis if it still gives problems. > > > > I've also restructured it a bit. > > > > Patch attached based on low-res-opt. Trunk version will be the same > > (but the patch would be different) > > > > Ticker > > > > On Mon, 2021-05-31 at 17:12 +0100, Ticker Berkin wrote: > > > Hi Gerd > > > > > > shapeSplitter will have problems (ie get it wrong some of the > > > time) > > > where there are in/out lines to a hole that share the same cut > > > point > > > as > > > a line that is the boundary between a shape and hole; could be > > > many > > > holes (or shapes) and many lines. The simple sort/dedupe I was > > > doing > > > isn't adequate. I'll come up with something better tomorrow. > > > > > > Ticker > > > > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I see what you mean. Is this with splitShaeFix_5_lowRes.patch? I'll investigate. Is there an OSM file I can run with? Ticker On Wed, 2021-06-02 at 06:32 +, Gerd Petermann wrote: > Hi Ticker, > > please check https://files.mkgmap.org.uk/download/509/special-v5.zip > > Can you tell me why ShapeSplitter drops some points, e.g the one near > 68.2669706, 15.1206053 without complaining? > None of the points in the original data is visited more than twice > and all highprec equal points are unique. > > I'm working on an improvement to make the connecting lines shorter, > but I don't see yet how I can avoid to have connecting lines like > that. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Dienstag, 1. Juni 2021 17:18 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > I've added code to deal with some variants of the case as described - > I > hope this will be enough to cope with more complex shapes generated > by > ShapeMerger. > > There might be a bit more I can do without having to resort to more > complex geometry analysis if it still gives problems. > > I've also restructured it a bit. > > Patch attached based on low-res-opt. Trunk version will be the same > (but the patch would be different) > > Ticker > > On Mon, 2021-05-31 at 17:12 +0100, Ticker Berkin wrote: > > Hi Gerd > > > > shapeSplitter will have problems (ie get it wrong some of the time) > > where there are in/out lines to a hole that share the same cut > > point > > as > > a line that is the boundary between a shape and hole; could be many > > holes (or shapes) and many lines. The simple sort/dedupe I was > > doing > > isn't adequate. I'll come up with something better tomorrow. > > > > Ticker > > > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, please check https://files.mkgmap.org.uk/download/509/special-v5.zip Can you tell me why ShapeSplitter drops some points, e.g the one near 68.2669706, 15.1206053 without complaining? None of the points in the original data is visited more than twice and all highprec equal points are unique. I'm working on an improvement to make the connecting lines shorter, but I don't see yet how I can avoid to have connecting lines like that. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Dienstag, 1. Juni 2021 17:18 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I've added code to deal with some variants of the case as described - I hope this will be enough to cope with more complex shapes generated by ShapeMerger. There might be a bit more I can do without having to resort to more complex geometry analysis if it still gives problems. I've also restructured it a bit. Patch attached based on low-res-opt. Trunk version will be the same (but the patch would be different) Ticker On Mon, 2021-05-31 at 17:12 +0100, Ticker Berkin wrote: > Hi Gerd > > shapeSplitter will have problems (ie get it wrong some of the time) > where there are in/out lines to a hole that share the same cut point > as > a line that is the boundary between a shape and hole; could be many > holes (or shapes) and many lines. The simple sort/dedupe I was doing > isn't adequate. I'll come up with something better tomorrow. > > Ticker > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I've added code to deal with some variants of the case as described - I hope this will be enough to cope with more complex shapes generated by ShapeMerger. There might be a bit more I can do without having to resort to more complex geometry analysis if it still gives problems. I've also restructured it a bit. Patch attached based on low-res-opt. Trunk version will be the same (but the patch would be different) Ticker On Mon, 2021-05-31 at 17:12 +0100, Ticker Berkin wrote: > Hi Gerd > > shapeSplitter will have problems (ie get it wrong some of the time) > where there are in/out lines to a hole that share the same cut point > as > a line that is the boundary between a shape and hole; could be many > holes (or shapes) and many lines. The simple sort/dedupe I was doing > isn't adequate. I'll come up with something better tomorrow. > > Ticker > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-devIndex: src/uk/me/parabola/util/ShapeSplitter.java === --- src/uk/me/parabola/util/ShapeSplitter.java (revision 4752) +++ src/uk/me/parabola/util/ShapeSplitter.java (working copy) @@ -275,11 +275,23 @@ return pointsToPath2D(outputList, countVals); } -/* Dec16/Jan17. Ticker Berkin. New implementation for splitting shapes. +// Dec16/Jan17. Ticker Berkin. New implementation for splitting shapes and clipping -Eventually maybe can be used instead of some of the above and elsewhere -*/ + private boolean detectedProblems; + private List newLess, newMore; + private String gpxDirectory; + private long fullArea; + private List lineInfo; // for the side we are working on + private List> origList; // ditto + + private boolean multSameLow; // lineInfo.sort(comparator) might set this + + private void logMsg(Object ... olist) { + detectedProblems = true; + log.warn(olist); + } + /** * Service routine for processLineList. Processes a nested list of holes within a shape or * list of shapes within a hole. @@ -290,11 +302,8 @@ * @param endEnclosed point where starting line ends on dividing line. * @param addHolesToThis if not null, then called from a shape and subtract holes from it * otherwise new shapes within a hole. - * @param lineInfo list of lines. - * @param origList list of shapes to which we append new shapes. */ - private static int doLines(int startInx, int endEnclosed, MergeCloseHelper addHolesToThis, - List lineInfo, List> origList) { + private int doLines(int startInx, int endEnclosed, MergeCloseHelper addHolesToThis) { int inx = startInx; final boolean calledFromHole = addHolesToThis == null; while (inx < lineInfo.size()) { @@ -304,9 +313,9 @@ if (thisLine.lowPoint == endEnclosed && thisLine.highPoint == endEnclosed) // consider carefully if (calledFromHole == (thisLine.areaOrHole == -1)) break; // stop if same type - inx = doLines(inx+1, thisLine.highPoint, calledFromHole ? thisLine : null, lineInfo, origList); + inx = doLines(inx+1, thisLine.highPoint, calledFromHole ? thisLine : null); if (calledFromHole) // handling list of shapes -thisLine.closeAppend(origList, true); +thisLine.closeAppend(true); else // handling list of holes addHolesToThis.addHole(thisLine); } @@ -317,17 +326,17 @@ * Service routine for splitShape. Takes list of lines and appends distinct shapes * @param lineInfo list of lines that start and end on the dividing line (or orig startPoint) * @param origList list of shapes to which we append new shapes formed from above - * @param fullArea of orig polygon. used for sign and handling of last line segment */ - private static int processLineList(List lineInfo, List> origList, long fullArea) { - int errorCount = 0; + private void processLineList(List lineInfoParam, List> origListParam) { + lineInfo = lineInfoParam; + origList = origListParam; if (origList == null) // never wanted this side - return errorCount; + return; MergeCloseHelper firstLine = lineInfo.get(0); if (lineInfo.size() == 1) { // single shape that never crossed line if (!firstLine.points.isEmpty()) // all on this side -firstLine.closeAppend(origList, false); - return errorCount; +firstLine.closeAppend(false); + return; } // look at last item in list of lines MergeCloseHelper lastLine = lineInfo.get(lineInfo.size()-1); @@ -335,14 +344,14 @@ lineInfo.remove(lineInfo.size()-1); else { // ended up on this side and must have crossed the line // so first element is really the end of the last - lastLine.combineFirstIntoLast(firstLine, fullArea); + lastLine.combineFirstIntoLast(firstLine); lineInfo.remove(0); firstLine = lineInfo.get(0); } if (lineInfo.size() == 1) { // simple poly that crossed once and back firstLine.setMoreInfo(0); - firstLine.closeAppend(origList, true); - ret
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, just to make sure: The triangle was connected to the outside. My algo to find holes also failed with that. I also tried a completely different approach using java path with WindingRule.WIND_EVEN_ODD (this is also used in JOSM). Works quite well but is much slower.. I'm back to the idea suggested in TODO: Keep the MP as is and do the splitting once for each level. I've implemented part of this but it only makes sense when the splitting is 100% reliable, else it is possible that huge areas are wrong. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Montag, 31. Mai 2021 18:12 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd shapeSplitter will have problems (ie get it wrong some of the time) where there are in/out lines to a hole that share the same cut point as a line that is the boundary between a shape and hole; could be many holes (or shapes) and many lines. The simple sort/dedupe I was doing isn't adequate. I'll come up with something better tomorrow. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd shapeSplitter will have problems (ie get it wrong some of the time) where there are in/out lines to a hole that share the same cut point as a line that is the boundary between a shape and hole; could be many holes (or shapes) and many lines. The simple sort/dedupe I was doing isn't adequate. I'll come up with something better tomorrow. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, I thought I already confirmed that the data that was used to produced water.osm was invalid? See http://gis.19327.n8.nabble.com/special-case-where-splitting-fails-without-a-log-message-tp5992337p5992479.html I've just committed r4746 in the low-res-opt branch, see my comments in the commit message https://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=4746 Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Freitag, 28. Mai 2021 18:24 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I'm coming to the conclusion that water.osm is invalid. I've attached an example part. This goes through the cut-line following the same path in and out, and defines both shape and a hole at the same time, which is impossible without the lines crossing. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd Some of the diags I've added to shapeSplitter might cause exceptions if log.isDebugEnabled() and one of the sides of the split isn't required. I didn't notice this for a while because just looking at the first part and Main doesn't show exception traces. The extra testing and error tracking are becoming unwieldy because of the way it is structured so I think I should enclose it in a class and tidy them up a bit - I'll do this next week. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I'm coming to the conclusion that water.osm is invalid. I've attached an example part. This goes through the cut-line following the same path in and out, and defines both shape and a hole at the same time, which is impossible without the lines crossing. Ticker http://www.topografix.com/GPX/1/1"; creator="mkgmap" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd";> V45802496_3182268/N4_hp___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, yes, we are getting closer ;) Attached is another special case where the splitter claims that something is wrong: SCHWERWIEGEND (ShapeSplitter): e:\xxx\63240001.osm.pbf: splitErrors: 1 on 43536384 true points 1076 area -42018655858 lowest 202035601 http://www.openstreetmap.org/?mlat=67.739804&mlon=14.564171&zoom=17 I don't see anything wrong in the result, though. o_hp.gpx is split into 3 parts s*.gpx Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Freitag, 28. Mai 2021 07:43 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd There is something about "water.osm" that is breaking the original logic of ShapeSplitter in a way I'm having trouble understanding. A whole lot of points get assigned to 2 loops. It doesn't seem to be related to multiple identical paths around the cut-line, which should now work correctly with this patch - sorry about the 2 failed attempts yesterday. You mentioned slightly adjusting the high-prec values to help shapeSplitter. I think it best not to do this. You'd have to get it absolutely correct all the way through and, say, in cases where 3 lines follow the same path it becomes impossible. Also the algo it makes some decisions on very fine distinctions in areas which allow it to get rid of spikes and similar and so this wouldn't happen. Patch attached. with INFO/DEBUG enabled, it generates lots of gps traces: original, the various loops either side of the cut-line and all the resultant shapes. Ticker On Fri, 2021-05-28 at 05:03 +, Gerd Petermann wrote: > Hi Ticker, > > I've probably not understood the problem before. I've added test code > to find situations where the ShapeSplitter complains and I found a > rather simple case where the ShapeMerger produces a self-crossing > shape (see attached gpx). Now I have an idea what to look for. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Gerd Petermann > Gesendet: Donnerstag, 27. Mai 2021 18:14 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Ticker, > > I've attached my current state of work as patch for the branch. > It fixes some bugs and merges shapes in a way that is less likely to > produce long connections to islands. > > I think the main problem for shape splitter is when such a connection > has a U-shape and the cut goes through it horizontally. But I'm just > guessing... > > Gerd > > ____ > Von: mkgmap-dev im Auftrag > von Gerd Petermann > Gesendet: Donnerstag, 27. Mai 2021 17:59 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Ticker, > > JOSM shows the islands properly when you zoom in. And yes, it shows > water on both sides of the connecting lines. Very simiar to the > Garmin renderer. > Does that help? > > Gerd > > ________________ > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 17:48 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > I'm confused. After mp hole cutting and shape merging, I expect a > single closed way that will have in/out lines, probably on top of > each > other, to connect each area that was a hole, eventually, to a point > on > the outside of the shape. > > However, JOSM does show the water band on the outside of what were > the > islands, and on both sides of the joining lines. > > Ticker > > On Thu, 2021-05-27 at 15:10 +, Gerd Petermann wrote: > > Hi Ticker, > > > > yes, sure. I've converted a gpx output to OSM. All polygons with > > holes are not valid OSM ways, but they are very normal as MapShape. > > Validator doesn't help much with these polygons. > > > > Gerd > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 17:06 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > JOSM gives a self-crossing way validation error on this. > > > > Ticker > > > > On Thu, 2021-05-27 at 14:53 +0000, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > no need to hurry ;) > > > Here is one: > > > https://files.mk
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd There is something about "water.osm" that is breaking the original logic of ShapeSplitter in a way I'm having trouble understanding. A whole lot of points get assigned to 2 loops. It doesn't seem to be related to multiple identical paths around the cut-line, which should now work correctly with this patch - sorry about the 2 failed attempts yesterday. You mentioned slightly adjusting the high-prec values to help shapeSplitter. I think it best not to do this. You'd have to get it absolutely correct all the way through and, say, in cases where 3 lines follow the same path it becomes impossible. Also the algo it makes some decisions on very fine distinctions in areas which allow it to get rid of spikes and similar and so this wouldn't happen. Patch attached. with INFO/DEBUG enabled, it generates lots of gps traces: original, the various loops either side of the cut-line and all the resultant shapes. Ticker On Fri, 2021-05-28 at 05:03 +, Gerd Petermann wrote: > Hi Ticker, > > I've probably not understood the problem before. I've added test code > to find situations where the ShapeSplitter complains and I found a > rather simple case where the ShapeMerger produces a self-crossing > shape (see attached gpx). Now I have an idea what to look for. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Gerd Petermann > Gesendet: Donnerstag, 27. Mai 2021 18:14 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Ticker, > > I've attached my current state of work as patch for the branch. > It fixes some bugs and merges shapes in a way that is less likely to > produce long connections to islands. > > I think the main problem for shape splitter is when such a connection > has a U-shape and the cut goes through it horizontally. But I'm just > guessing... > > Gerd > > > Von: mkgmap-dev im Auftrag > von Gerd Petermann > Gesendet: Donnerstag, 27. Mai 2021 17:59 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Ticker, > > JOSM shows the islands properly when you zoom in. And yes, it shows > water on both sides of the connecting lines. Very simiar to the > Garmin renderer. > Does that help? > > Gerd > > ________________ > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 17:48 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > I'm confused. After mp hole cutting and shape merging, I expect a > single closed way that will have in/out lines, probably on top of > each > other, to connect each area that was a hole, eventually, to a point > on > the outside of the shape. > > However, JOSM does show the water band on the outside of what were > the > islands, and on both sides of the joining lines. > > Ticker > > On Thu, 2021-05-27 at 15:10 +, Gerd Petermann wrote: > > Hi Ticker, > > > > yes, sure. I've converted a gpx output to OSM. All polygons with > > holes are not valid OSM ways, but they are very normal as MapShape. > > Validator doesn't help much with these polygons. > > > > Gerd > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 17:06 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > JOSM gives a self-crossing way validation error on this. > > > > Ticker > > > > On Thu, 2021-05-27 at 14:53 +0000, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > no need to hurry ;) > > > Here is one: > > > https://files.mkgmap.org.uk/download/508/water.osm > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 16:47 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Hi Gerd > > > > > > next patch also has a problem - sorry to waste your time. > > &
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, I've probably not understood the problem before. I've added test code to find situations where the ShapeSplitter complains and I found a rather simple case where the ShapeMerger produces a self-crossing shape (see attached gpx). Now I have an idea what to look for. Gerd Von: mkgmap-dev im Auftrag von Gerd Petermann Gesendet: Donnerstag, 27. Mai 2021 18:14 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Ticker, I've attached my current state of work as patch for the branch. It fixes some bugs and merges shapes in a way that is less likely to produce long connections to islands. I think the main problem for shape splitter is when such a connection has a U-shape and the cut goes through it horizontally. But I'm just guessing... Gerd Von: mkgmap-dev im Auftrag von Gerd Petermann Gesendet: Donnerstag, 27. Mai 2021 17:59 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Ticker, JOSM shows the islands properly when you zoom in. And yes, it shows water on both sides of the connecting lines. Very simiar to the Garmin renderer. Does that help? Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 17:48 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I'm confused. After mp hole cutting and shape merging, I expect a single closed way that will have in/out lines, probably on top of each other, to connect each area that was a hole, eventually, to a point on the outside of the shape. However, JOSM does show the water band on the outside of what were the islands, and on both sides of the joining lines. Ticker On Thu, 2021-05-27 at 15:10 +, Gerd Petermann wrote: > Hi Ticker, > > yes, sure. I've converted a gpx output to OSM. All polygons with > holes are not valid OSM ways, but they are very normal as MapShape. > Validator doesn't help much with these polygons. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 17:06 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > JOSM gives a self-crossing way validation error on this. > > Ticker > > On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > > Hi Ticker, > > > > no need to hurry ;) > > Here is one: > > https://files.mkgmap.org.uk/download/508/water.osm > > > > Gerd > > > > ____ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:47 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > next patch also has a problem - sorry to waste your time. > > Can I have your test data. > > > > Ticker > > > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > with my current test environment the patch doesn't improve the > > > result. > > > It reports some errors (the old code didn't always detect them) > > > and > > > eithers add or removes parts of the heavily merged shapes. > > > > > > I've inspected one shape and found no obvious problem. No point > > > is > > > visited more then twice, but 167 points are visited twice. Let me > > > know if you need the data. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Thanks Gerd, that works for me > > > > > > Ticker > > > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > > natural=water > > > > Next execute validator which will complain that the way is not > > > > closed. > > > > Right click on that warning allows to "zoom to probl
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, I've attached my current state of work as patch for the branch. It fixes some bugs and merges shapes in a way that is less likely to produce long connections to islands. I think the main problem for shape splitter is when such a connection has a U-shape and the cut goes through it horizontally. But I'm just guessing... Gerd Von: mkgmap-dev im Auftrag von Gerd Petermann Gesendet: Donnerstag, 27. Mai 2021 17:59 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Ticker, JOSM shows the islands properly when you zoom in. And yes, it shows water on both sides of the connecting lines. Very simiar to the Garmin renderer. Does that help? Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 17:48 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I'm confused. After mp hole cutting and shape merging, I expect a single closed way that will have in/out lines, probably on top of each other, to connect each area that was a hole, eventually, to a point on the outside of the shape. However, JOSM does show the water band on the outside of what were the islands, and on both sides of the joining lines. Ticker On Thu, 2021-05-27 at 15:10 +, Gerd Petermann wrote: > Hi Ticker, > > yes, sure. I've converted a gpx output to OSM. All polygons with > holes are not valid OSM ways, but they are very normal as MapShape. > Validator doesn't help much with these polygons. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 17:06 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > JOSM gives a self-crossing way validation error on this. > > Ticker > > On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > > Hi Ticker, > > > > no need to hurry ;) > > Here is one: > > https://files.mkgmap.org.uk/download/508/water.osm > > > > Gerd > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:47 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > next patch also has a problem - sorry to waste your time. > > Can I have your test data. > > > > Ticker > > > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > with my current test environment the patch doesn't improve the > > > result. > > > It reports some errors (the old code didn't always detect them) > > > and > > > eithers add or removes parts of the heavily merged shapes. > > > > > > I've inspected one shape and found no obvious problem. No point > > > is > > > visited more then twice, but 167 points are visited twice. Let me > > > know if you need the data. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Thanks Gerd, that works for me > > > > > > Ticker > > > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > > natural=water > > > > Next execute validator which will complain that the way is not > > > > closed. > > > > Right click on that warning allows to "zoom to problem" . > > > > This tells you where the first point is. > > > > > > > > In the "OSM data" preferences I've enabled "Draw segment order > > > > numbers on selected way" > > > > > > > > Hope this helps. > > > > > > > > Gerd > > > > > > > > > > > > Von: mkgmap-dev im > > > > Auftrag > > > > von Ticker Berkin > &g
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, JOSM shows the islands properly when you zoom in. And yes, it shows water on both sides of the connecting lines. Very simiar to the Garmin renderer. Does that help? Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 17:48 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I'm confused. After mp hole cutting and shape merging, I expect a single closed way that will have in/out lines, probably on top of each other, to connect each area that was a hole, eventually, to a point on the outside of the shape. However, JOSM does show the water band on the outside of what were the islands, and on both sides of the joining lines. Ticker On Thu, 2021-05-27 at 15:10 +, Gerd Petermann wrote: > Hi Ticker, > > yes, sure. I've converted a gpx output to OSM. All polygons with > holes are not valid OSM ways, but they are very normal as MapShape. > Validator doesn't help much with these polygons. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 17:06 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > JOSM gives a self-crossing way validation error on this. > > Ticker > > On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > > Hi Ticker, > > > > no need to hurry ;) > > Here is one: > > https://files.mkgmap.org.uk/download/508/water.osm > > > > Gerd > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:47 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > next patch also has a problem - sorry to waste your time. > > Can I have your test data. > > > > Ticker > > > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > with my current test environment the patch doesn't improve the > > > result. > > > It reports some errors (the old code didn't always detect them) > > > and > > > eithers add or removes parts of the heavily merged shapes. > > > > > > I've inspected one shape and found no obvious problem. No point > > > is > > > visited more then twice, but 167 points are visited twice. Let me > > > know if you need the data. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Thanks Gerd, that works for me > > > > > > Ticker > > > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > > natural=water > > > > Next execute validator which will complain that the way is not > > > > closed. > > > > Right click on that warning allows to "zoom to problem" . > > > > This tells you where the first point is. > > > > > > > > In the "OSM data" preferences I've enabled "Draw segment order > > > > numbers on selected way" > > > > > > > > Hope this helps. > > > > > > > > Gerd > > > > > > > > > > > > Von: mkgmap-dev im > > > > Auftrag > > > > von Ticker Berkin > > > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > > > An: Development list for mkgmap > > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > > without > > > > a log message > > > > > > > > Hi Gerd > > > > > > > > Trying to use JOSM to decide if a gpx trace represents a self > > > > -intersecting polygon is difficult. Is there a way of forcing > > > > it > > > > to > > > > consider it closed and then check itself? Failing that
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I'm confused. After mp hole cutting and shape merging, I expect a single closed way that will have in/out lines, probably on top of each other, to connect each area that was a hole, eventually, to a point on the outside of the shape. However, JOSM does show the water band on the outside of what were the islands, and on both sides of the joining lines. Ticker On Thu, 2021-05-27 at 15:10 +, Gerd Petermann wrote: > Hi Ticker, > > yes, sure. I've converted a gpx output to OSM. All polygons with > holes are not valid OSM ways, but they are very normal as MapShape. > Validator doesn't help much with these polygons. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 17:06 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > JOSM gives a self-crossing way validation error on this. > > Ticker > > On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > > Hi Ticker, > > > > no need to hurry ;) > > Here is one: > > https://files.mkgmap.org.uk/download/508/water.osm > > > > Gerd > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:47 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > next patch also has a problem - sorry to waste your time. > > Can I have your test data. > > > > Ticker > > > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > with my current test environment the patch doesn't improve the > > > result. > > > It reports some errors (the old code didn't always detect them) > > > and > > > eithers add or removes parts of the heavily merged shapes. > > > > > > I've inspected one shape and found no obvious problem. No point > > > is > > > visited more then twice, but 167 points are visited twice. Let me > > > know if you need the data. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Thanks Gerd, that works for me > > > > > > Ticker > > > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > > natural=water > > > > Next execute validator which will complain that the way is not > > > > closed. > > > > Right click on that warning allows to "zoom to problem" . > > > > This tells you where the first point is. > > > > > > > > In the "OSM data" preferences I've enabled "Draw segment order > > > > numbers on selected way" > > > > > > > > Hope this helps. > > > > > > > > Gerd > > > > > > > > > > > > Von: mkgmap-dev im > > > > Auftrag > > > > von Ticker Berkin > > > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > > > An: Development list for mkgmap > > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > > without > > > > a log message > > > > > > > > Hi Gerd > > > > > > > > Trying to use JOSM to decide if a gpx trace represents a self > > > > -intersecting polygon is difficult. Is there a way of forcing > > > > it > > > > to > > > > consider it closed and then check itself? Failing that, number > > > > the > > > > points or segments somehow. > > > > > > > > Ticker > > > > > > > > > > > > ___ > > > > mkgmap-dev mailing list > > > > mkgmap-dev@lists.mkgmap.org.uk > > > > https://www.mkgmap.org.uk/mailman/listinfo/mk
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, yes, sure. I've converted a gpx output to OSM. All polygons with holes are not valid OSM ways, but they are very normal as MapShape. Validator doesn't help much with these polygons. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 17:06 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd JOSM gives a self-crossing way validation error on this. Ticker On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > Hi Ticker, > > no need to hurry ;) > Here is one: > https://files.mkgmap.org.uk/download/508/water.osm > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 16:47 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > next patch also has a problem - sorry to waste your time. > Can I have your test data. > > Ticker > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > Hi Ticker, > > > > with my current test environment the patch doesn't improve the > > result. > > It reports some errors (the old code didn't always detect them) and > > eithers add or removes parts of the heavily merged shapes. > > > > I've inspected one shape and found no obvious problem. No point is > > visited more then twice, but 167 points are visited twice. Let me > > know if you need the data. > > > > Gerd > > > > ________________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Thanks Gerd, that works for me > > > > Ticker > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > natural=water > > > Next execute validator which will complain that the way is not > > > closed. > > > Right click on that warning allows to "zoom to problem" . > > > This tells you where the first point is. > > > > > > In the "OSM data" preferences I've enabled "Draw segment order > > > numbers on selected way" > > > > > > Hope this helps. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Hi Gerd > > > > > > Trying to use JOSM to decide if a gpx trace represents a self > > > -intersecting polygon is difficult. Is there a way of forcing it > > > to > > > consider it closed and then check itself? Failing that, number > > > the > > > points or segments somehow. > > > > > > Ticker > > > > > > > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd JOSM gives a self-crossing way validation error on this. Ticker On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > Hi Ticker, > > no need to hurry ;) > Here is one: > https://files.mkgmap.org.uk/download/508/water.osm > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 16:47 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > next patch also has a problem - sorry to waste your time. > Can I have your test data. > > Ticker > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > Hi Ticker, > > > > with my current test environment the patch doesn't improve the > > result. > > It reports some errors (the old code didn't always detect them) and > > eithers add or removes parts of the heavily merged shapes. > > > > I've inspected one shape and found no obvious problem. No point is > > visited more then twice, but 167 points are visited twice. Let me > > know if you need the data. > > > > Gerd > > > > ________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Thanks Gerd, that works for me > > > > Ticker > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > natural=water > > > Next execute validator which will complain that the way is not > > > closed. > > > Right click on that warning allows to "zoom to problem" . > > > This tells you where the first point is. > > > > > > In the "OSM data" preferences I've enabled "Draw segment order > > > numbers on selected way" > > > > > > Hope this helps. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Hi Gerd > > > > > > Trying to use JOSM to decide if a gpx trace represents a self > > > -intersecting polygon is difficult. Is there a way of forcing it > > > to > > > consider it closed and then check itself? Failing that, number > > > the > > > points or segments somehow. > > > > > > Ticker > > > > > > > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd JOSM gives a self-crossing way validation error on this. Ticker On Thu, 2021-05-27 at 14:53 +, Gerd Petermann wrote: > Hi Ticker, > > no need to hurry ;) > Here is one: > https://files.mkgmap.org.uk/download/508/water.osm > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 16:47 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > next patch also has a problem - sorry to waste your time. > Can I have your test data. > > Ticker > > On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > > Hi Ticker, > > > > with my current test environment the patch doesn't improve the > > result. > > It reports some errors (the old code didn't always detect them) and > > eithers add or removes parts of the heavily merged shapes. > > > > I've inspected one shape and found no obvious problem. No point is > > visited more then twice, but 167 points are visited twice. Let me > > know if you need the data. > > > > Gerd > > > > ________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 16:09 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Thanks Gerd, that works for me > > > > Ticker > > > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > I first convert the gpx layer to a data layer, then add the tag > > > natural=water > > > Next execute validator which will complain that the way is not > > > closed. > > > Right click on that warning allows to "zoom to problem" . > > > This tells you where the first point is. > > > > > > In the "OSM data" preferences I've enabled "Draw segment order > > > numbers on selected way" > > > > > > Hope this helps. > > > > > > Gerd > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Hi Gerd > > > > > > Trying to use JOSM to decide if a gpx trace represents a self > > > -intersecting polygon is difficult. Is there a way of forcing it > > > to > > > consider it closed and then check itself? Failing that, number > > > the > > > points or segments somehow. > > > > > > Ticker > > > > > > > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, no need to hurry ;) Here is one: https://files.mkgmap.org.uk/download/508/water.osm Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 16:47 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd next patch also has a problem - sorry to waste your time. Can I have your test data. Ticker On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > Hi Ticker, > > with my current test environment the patch doesn't improve the > result. > It reports some errors (the old code didn't always detect them) and > eithers add or removes parts of the heavily merged shapes. > > I've inspected one shape and found no obvious problem. No point is > visited more then twice, but 167 points are visited twice. Let me > know if you need the data. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 16:09 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Thanks Gerd, that works for me > > Ticker > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > Hi Ticker, > > > > I first convert the gpx layer to a data layer, then add the tag > > natural=water > > Next execute validator which will complain that the way is not > > closed. > > Right click on that warning allows to "zoom to problem" . > > This tells you where the first point is. > > > > In the "OSM data" preferences I've enabled "Draw segment order > > numbers on selected way" > > > > Hope this helps. > > > > Gerd > > > > ________________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > Trying to use JOSM to decide if a gpx trace represents a self > > -intersecting polygon is difficult. Is there a way of forcing it to > > consider it closed and then check itself? Failing that, number the > > points or segments somehow. > > > > Ticker > > > > > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd next patch also has a problem - sorry to waste your time. Can I have your test data. Ticker On Thu, 2021-05-27 at 14:33 +, Gerd Petermann wrote: > Hi Ticker, > > with my current test environment the patch doesn't improve the > result. > It reports some errors (the old code didn't always detect them) and > eithers add or removes parts of the heavily merged shapes. > > I've inspected one shape and found no obvious problem. No point is > visited more then twice, but 167 points are visited twice. Let me > know if you need the data. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 16:09 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Thanks Gerd, that works for me > > Ticker > > On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > > Hi Ticker, > > > > I first convert the gpx layer to a data layer, then add the tag > > natural=water > > Next execute validator which will complain that the way is not > > closed. > > Right click on that warning allows to "zoom to problem" . > > This tells you where the first point is. > > > > In the "OSM data" preferences I've enabled "Draw segment order > > numbers on selected way" > > > > Hope this helps. > > > > Gerd > > > > ________________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Donnerstag, 27. Mai 2021 14:21 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > Trying to use JOSM to decide if a gpx trace represents a self > > -intersecting polygon is difficult. Is there a way of forcing it to > > consider it closed and then check itself? Failing that, number the > > points or segments somehow. > > > > Ticker > > > > > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd Found stupid mistake, updated patch attached. Also, if debug enabled, always splits both sides of the line, and, if both sides are collected to the same list, just gives 1 gpx trace for it. Ticker On Thu, 2021-05-27 at 10:54 +, Gerd Petermann wrote: > Hi Ticker, > > sounds good. I'm making progress with a better ShapeMerger that > produces less jitter, but so far it still produces some. > Will try it later.. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 12:49 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > I think this can cope with any number of lines, in either/both > directions, following the same path. Also it should give better > output > if same number of lines in both directions. > > With debug, if it notices a problem, it generates a GPX trace of the > original and traces of all the resultant bits individually in a > subdirectory relevant to the split line. > > I've tested it on a few examples, but I'll stress-test GBR again and > check the shapes where it detects problems. > > I probably need to tidy up some message levels and comments. > > Ticker > > On Wed, 2021-05-26 at 11:17 +0100, Ticker Berkin wrote: > > Hi Gerd > > > > I have to design a shape that does this and think what it means. > > With > > the extra handling needed for identical opposite lines it will be > > easy > > to detect. Maybe possible to just chuck it. > > > > I'm out for the rest of the day so can't do anything until > > tomorrow. > > > > Ticker > > > > On Wed, 2021-05-26 at 08:46 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > OK, I think your patch improves some cases. I've also fixed > > > another > > > potential cause for these problems with r4744. > > > > > > I think I have to find a way to avoid those segments which are > > > visited multiple times in the same direction. There's probably > > > always > > > an alternative merge order that avoids this. > > > > > > Gerd > > > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-devIndex: src/uk/me/parabola/util/ShapeSplitter.java === --- src/uk/me/parabola/util/ShapeSplitter.java (revision 4745) +++ src/uk/me/parabola/util/ShapeSplitter.java (working copy) @@ -12,21 +12,20 @@ */ package uk.me.parabola.util; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.awt.Shape; import java.awt.geom.Path2D; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; -// RWB new bits -import java.util.ArrayList; -import java.util.List; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import uk.me.parabola.imgfmt.Utils; import uk.me.parabola.imgfmt.app.Area; import uk.me.parabola.imgfmt.app.Coord; - import uk.me.parabola.log.Logger; +import uk.me.parabola.util.GpxCreator; public class ShapeSplitter { private static final Logger log = Logger.getLogger(ShapeSplitter.class); @@ -321,14 +320,15 @@ * @param origList list of shapes to which we append new shapes formed from above * @param fullArea of orig polygon. used for sign and handling of last line segment */ - private static void processLineList(List lineInfo, List> origList, long fullArea) { + private static int processLineList(List lineInfo, List> origList, long fullArea) { + int errorCount = 0; if (origList == null) // never wanted this side - return; + return errorCount; MergeCloseHelper firstLine = lineInfo.get(0); if (lineInfo.size() == 1) { // single shape that never crossed line if (!firstLine.points.isEmpty()) // all on this side firstLine.closeAppend(origList, false); - return; + return errorCount; } // look at last item in list of lines MergeCloseHelper lastLine = lineInfo.get(lineInfo.size()-1); @@ -343,7 +343,7 @@ if (lineInfo.size() == 1) { // simple poly that crossed once and back firstLine.setMoreInfo(0); firstLine.closeAppend(origList, true); - return; + return errorCount; } // Above were the simple cases - probably 99% of calls. @@ -360,7 +360,7 @@ boolean someDirectionsNot
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, with my current test environment the patch doesn't improve the result. It reports some errors (the old code didn't always detect them) and eithers add or removes parts of the heavily merged shapes. I've inspected one shape and found no obvious problem. No point is visited more then twice, but 167 points are visited twice. Let me know if you need the data. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 16:09 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Thanks Gerd, that works for me Ticker On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > Hi Ticker, > > I first convert the gpx layer to a data layer, then add the tag > natural=water > Next execute validator which will complain that the way is not > closed. > Right click on that warning allows to "zoom to problem" . > This tells you where the first point is. > > In the "OSM data" preferences I've enabled "Draw segment order > numbers on selected way" > > Hope this helps. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 14:21 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > Trying to use JOSM to decide if a gpx trace represents a self > -intersecting polygon is difficult. Is there a way of forcing it to > consider it closed and then check itself? Failing that, number the > points or segments somehow. > > Ticker > > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Thanks Gerd, that works for me Ticker On Thu, 2021-05-27 at 12:54 +, Gerd Petermann wrote: > Hi Ticker, > > I first convert the gpx layer to a data layer, then add the tag > natural=water > Next execute validator which will complain that the way is not > closed. > Right click on that warning allows to "zoom to problem" . > This tells you where the first point is. > > In the "OSM data" preferences I've enabled "Draw segment order > numbers on selected way" > > Hope this helps. > > Gerd > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Donnerstag, 27. Mai 2021 14:21 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > Trying to use JOSM to decide if a gpx trace represents a self > -intersecting polygon is difficult. Is there a way of forcing it to > consider it closed and then check itself? Failing that, number the > points or segments somehow. > > Ticker > > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, I first convert the gpx layer to a data layer, then add the tag natural=water Next execute validator which will complain that the way is not closed. Right click on that warning allows to "zoom to problem" . This tells you where the first point is. In the "OSM data" preferences I've enabled "Draw segment order numbers on selected way" Hope this helps. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 14:21 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd Trying to use JOSM to decide if a gpx trace represents a self -intersecting polygon is difficult. Is there a way of forcing it to consider it closed and then check itself? Failing that, number the points or segments somehow. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd Trying to use JOSM to decide if a gpx trace represents a self -intersecting polygon is difficult. Is there a way of forcing it to consider it closed and then check itself? Failing that, number the points or segments somehow. Ticker ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, sounds good. I'm making progress with a better ShapeMerger that produces less jitter, but so far it still produces some. Will try it later.. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Donnerstag, 27. Mai 2021 12:49 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I think this can cope with any number of lines, in either/both directions, following the same path. Also it should give better output if same number of lines in both directions. With debug, if it notices a problem, it generates a GPX trace of the original and traces of all the resultant bits individually in a subdirectory relevant to the split line. I've tested it on a few examples, but I'll stress-test GBR again and check the shapes where it detects problems. I probably need to tidy up some message levels and comments. Ticker On Wed, 2021-05-26 at 11:17 +0100, Ticker Berkin wrote: > Hi Gerd > > I have to design a shape that does this and think what it means. With > the extra handling needed for identical opposite lines it will be > easy > to detect. Maybe possible to just chuck it. > > I'm out for the rest of the day so can't do anything until tomorrow. > > Ticker > > On Wed, 2021-05-26 at 08:46 +, Gerd Petermann wrote: > > Hi Ticker, > > > > OK, I think your patch improves some cases. I've also fixed another > > potential cause for these problems with r4744. > > > > I think I have to find a way to avoid those segments which are > > visited multiple times in the same direction. There's probably > > always > > an alternative merge order that avoids this. > > > > Gerd > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I think this can cope with any number of lines, in either/both directions, following the same path. Also it should give better output if same number of lines in both directions. With debug, if it notices a problem, it generates a GPX trace of the original and traces of all the resultant bits individually in a subdirectory relevant to the split line. I've tested it on a few examples, but I'll stress-test GBR again and check the shapes where it detects problems. I probably need to tidy up some message levels and comments. Ticker On Wed, 2021-05-26 at 11:17 +0100, Ticker Berkin wrote: > Hi Gerd > > I have to design a shape that does this and think what it means. With > the extra handling needed for identical opposite lines it will be > easy > to detect. Maybe possible to just chuck it. > > I'm out for the rest of the day so can't do anything until tomorrow. > > Ticker > > On Wed, 2021-05-26 at 08:46 +, Gerd Petermann wrote: > > Hi Ticker, > > > > OK, I think your patch improves some cases. I've also fixed another > > potential cause for these problems with r4744. > > > > I think I have to find a way to avoid those segments which are > > visited multiple times in the same direction. There's probably > > always > > an alternative merge order that avoids this. > > > > Gerd > > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-devIndex: src/uk/me/parabola/util/ShapeSplitter.java === --- src/uk/me/parabola/util/ShapeSplitter.java (revision 4745) +++ src/uk/me/parabola/util/ShapeSplitter.java (working copy) @@ -12,21 +12,20 @@ */ package uk.me.parabola.util; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.awt.Shape; import java.awt.geom.Path2D; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; -// RWB new bits -import java.util.ArrayList; -import java.util.List; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import uk.me.parabola.imgfmt.Utils; import uk.me.parabola.imgfmt.app.Area; import uk.me.parabola.imgfmt.app.Coord; - import uk.me.parabola.log.Logger; +import uk.me.parabola.util.GpxCreator; public class ShapeSplitter { private static final Logger log = Logger.getLogger(ShapeSplitter.class); @@ -321,14 +320,15 @@ * @param origList list of shapes to which we append new shapes formed from above * @param fullArea of orig polygon. used for sign and handling of last line segment */ - private static void processLineList(List lineInfo, List> origList, long fullArea) { + private static int processLineList(List lineInfo, List> origList, long fullArea) { + int errorCount = 0; if (origList == null) // never wanted this side - return; + return errorCount; MergeCloseHelper firstLine = lineInfo.get(0); if (lineInfo.size() == 1) { // single shape that never crossed line if (!firstLine.points.isEmpty()) // all on this side firstLine.closeAppend(origList, false); - return; + return errorCount; } // look at last item in list of lines MergeCloseHelper lastLine = lineInfo.get(lineInfo.size()-1); @@ -343,7 +343,7 @@ if (lineInfo.size() == 1) { // simple poly that crossed once and back firstLine.setMoreInfo(0); firstLine.closeAppend(origList, true); - return; + return errorCount; } // Above were the simple cases - probably 99% of calls. @@ -360,7 +360,7 @@ boolean someDirectionsNotSet = false; int areaDirection = 0; String diagMsg = ""; - for (MergeCloseHelper thisLine : lineInfo) { + for (MergeCloseHelper thisLine : lineInfo) { thisLine.setMoreInfo(fullAreaSign); if (thisLine.direction == 0) someDirectionsNotSet = true; @@ -382,20 +382,58 @@ } if (!diagMsg.isEmpty()) { log.warn(diagMsg, "Probably self-intersecting polygon", fullAreaSign, someDirectionsNotSet, areaDirection); - for (MergeCloseHelper thisLine : lineInfo) { -log.warn(thisLine); -if (log.isDebugEnabled()) - for (Coord co : thisLine.points) - log.debug("line", co, co.getHighPrecLat(), co.getHighPrecLon()); - } + ++errorCount; } lineInfo.sort(null); + errorCount += processDups(lineInfo); int dummy = doLines(0, Integer.MAX_VALUE, null, lineInfo, origList); assert dummy == lineInfo.size(); + for (MergeCloseHelper thisLine : lineInfo) + errorCount += thisLine.errorCount; + return errorCount; } // processLineList + private static int processDups(List lineInfo) { + // find groups of duplicates, drop equal numbers of different direction (ie keep just 1) + int errorCount = 0; // shouldn't be any + List newList = new ArrayList<>(lineInfo.size()); + MergeCloseHelper forwardLine = null, backwardLine = null, lastIfDup = null; + int directionBalance = 0; + for (MergeCloseHelper thi
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I have to design a shape that does this and think what it means. With the extra handling needed for identical opposite lines it will be easy to detect. Maybe possible to just chuck it. I'm out for the rest of the day so can't do anything until tomorrow. Ticker On Wed, 2021-05-26 at 08:46 +, Gerd Petermann wrote: > Hi Ticker, > > OK, I think your patch improves some cases. I've also fixed another > potential cause for these problems with r4744. > > I think I have to find a way to avoid those segments which are > visited multiple times in the same direction. There's probably always > an alternative merge order that avoids this. > > Gerd ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, OK, I think your patch improves some cases. I've also fixed another potential cause for these problems with r4744. I think I have to find a way to avoid those segments which are visited multiple times in the same direction. There's probably always an alternative merge order that avoids this. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Mittwoch, 26. Mai 2021 10:36 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd I hope the only case where my algo still has problems is when 2 lines intersect the cut line at identical points and they have the same area to that side of the line (implying they follow exactly the same path or intersect each other). This should generate the warning: "Lines hit divider at same points and have same area sign" I've been thinking of ways to resolve this and should be possible. If you are not seeing this warning and it is flagging errors, then either another pathological case that I need to consider or it is self -intersecting. My last patch should, I hope, fix the case you mention unless - see above. I stress-tested with GB, trunk. shapeMerge with no point limit and got a few examples of this and some "shape / hole" conflict, which I think might be real self-intersection problems. I'm going to add more diags and generate a gpx when errors/debugEnabled. I was hoping to find a good self-intersection algo, but the ones I thought might be ok are good for detecting line segments that cross but not for when all the difficulties are lines following each other and crossings happen at nodes. Ticker On Wed, 2021-05-26 at 04:46 +, Gerd Petermann wrote: > Hi Ticker, > > doesn't help much with the low-res-opt branch. I've attached a patch > which contains my test code. It writes gpx files, so please modify > the path. > I use it with in Eclipse a breakpoint on the line > log.error("split failed, ratio:", ratio); > to be able to load the GPX files into JOSM for further analyses. > I use it with my precomp-sea test-environment, see http://gis.19327.n > 8.nabble.com/precomp-sea-test-environment-tt5974624.html > options: > --output-dir=e:\ld --gmapi --precomp-sea=f:\osm\sea.zip --max > -jobs=1 --style-file=e:\precomp-sea-check\sea-check -c e:\precomp-sea > -check\tiles\template.args > > or with the files in https://files.mkgmap.org.uk/download/507/xxx.zip > and options > --output-dir=e:\ld --gmapi --generate-sea=multipolygon,floodblocker > --max-jobs=1 --preserve-element-order --allow-reverse-merge -c > e:\xxx\template.args > > If I got that right your algo has problems when the polygon goes > through points A and B twice, once in A-B direction and and again in > B-A and the cut is between A and B? > > I try to find efficient code to detect and avoid just those. > > Gerd ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I hope the only case where my algo still has problems is when 2 lines intersect the cut line at identical points and they have the same area to that side of the line (implying they follow exactly the same path or intersect each other). This should generate the warning: "Lines hit divider at same points and have same area sign" I've been thinking of ways to resolve this and should be possible. If you are not seeing this warning and it is flagging errors, then either another pathological case that I need to consider or it is self -intersecting. My last patch should, I hope, fix the case you mention unless - see above. I stress-tested with GB, trunk. shapeMerge with no point limit and got a few examples of this and some "shape / hole" conflict, which I think might be real self-intersection problems. I'm going to add more diags and generate a gpx when errors/debugEnabled. I was hoping to find a good self-intersection algo, but the ones I thought might be ok are good for detecting line segments that cross but not for when all the difficulties are lines following each other and crossings happen at nodes. Ticker On Wed, 2021-05-26 at 04:46 +, Gerd Petermann wrote: > Hi Ticker, > > doesn't help much with the low-res-opt branch. I've attached a patch > which contains my test code. It writes gpx files, so please modify > the path. > I use it with in Eclipse a breakpoint on the line > log.error("split failed, ratio:", ratio); > to be able to load the GPX files into JOSM for further analyses. > I use it with my precomp-sea test-environment, see http://gis.19327.n > 8.nabble.com/precomp-sea-test-environment-tt5974624.html > options: > --output-dir=e:\ld --gmapi --precomp-sea=f:\osm\sea.zip --max > -jobs=1 --style-file=e:\precomp-sea-check\sea-check -c e:\precomp-sea > -check\tiles\template.args > > or with the files in https://files.mkgmap.org.uk/download/507/xxx.zip > and options > --output-dir=e:\ld --gmapi --generate-sea=multipolygon,floodblocker > --max-jobs=1 --preserve-element-order --allow-reverse-merge -c > e:\xxx\template.args > > If I got that right your algo has problems when the polygon goes > through points A and B twice, once in A-B direction and and again in > B-A and the cut is between A and B? > > I try to find efficient code to detect and avoid just those. > > Gerd ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, doesn't help much with the low-res-opt branch. I've attached a patch which contains my test code. It writes gpx files, so please modify the path. I use it with in Eclipse a breakpoint on the line log.error("split failed, ratio:", ratio); to be able to load the GPX files into JOSM for further analyses. I use it with my precomp-sea test-environment, see http://gis.19327.n8.nabble.com/precomp-sea-test-environment-tt5974624.html options: --output-dir=e:\ld --gmapi --precomp-sea=f:\osm\sea.zip --max-jobs=1 --style-file=e:\precomp-sea-check\sea-check -c e:\precomp-sea-check\tiles\template.args or with the files in https://files.mkgmap.org.uk/download/507/xxx.zip and options --output-dir=e:\ld --gmapi --generate-sea=multipolygon,floodblocker --max-jobs=1 --preserve-element-order --allow-reverse-merge -c e:\xxx\template.args If I got that right your algo has problems when the polygon goes through points A and B twice, once in A-B direction and and again in B-A and the cut is between A and B? I try to find efficient code to detect and avoid just those. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Dienstag, 25. Mai 2021 18:49 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Sorry - excess stuff in patch, correct one now. Ticker On Tue, 2021-05-25 at 17:46 +0100, Ticker Berkin wrote: > Hi Gerd > > Patch attached that I hope fixes the splitting problem. > > I haven't looked at your change yet, but your split-failed.osm test > had, and needed, lots of points visited twice and I don't see how > this > can, or should, be avoided. > > Ticker > > On Tue, 2021-05-25 at 15:56 +, Gerd Petermann wrote: > > Hi Ticker, > > > > with the attached patch ShapeMerger avoids to produce shapes where > > more than the start point is visited twice. > > This produces much larger img files (even larger than trunk) but > > PolygonSplitter doesn't complain. > > > > I have to find out what GpsMapEdit means with "has a jitter". Maybe > > only those are problematic. > > > > Gerd > > > > > > ________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 25. Mai 2021 14:00 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Sorry - sea.zip! > > > > On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote: > > > Hi Gerd > > > > > > I'm getting very confused by this. When I build with my trunk > > > (some > > > filter order changes + a few others), I see a whole lot more that > > > JOSM > > > shows. It and your 6324001.img just show a central bit. Looking > > > with > > > GPSMapEdit with "Highlight Polygon Contours". I also see areas > > > where > > > all islands are inverted. > > > > > > I'll undo my trunk changes and look again. > > > > > > Does JOSM have self-intersection checking? > > > > > > Was the gpx trace hi-res (30bit) and then this kept when > > > generating > > > the > > > osm. If not, then I'd expect problems. > > > > > > Ticker > > > > > > > > > On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I didn't investigate the details. I've created the osm data by > > > > converting a gpx back to osm. I guess in the original input > > > > duplicate > > > > points are identical. I found more such cases where parts are > > > > removed. > > > > > > > > Gerd > > > > > > > > > > > > > > > > Von: mkgmap-dev im > > > > Auftrag > > > > von Ticker Berkin > > > > Gesendet: Dienstag, 25. Mai 2021 12:51 > > > > An: Development list for mkgmap > > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > > without > > > > a log message > > > > > > > > Hi Gerd > > > > > > > > OK - I've reproduced this. Is split-failed.osm self > > > > -intersecting? > > > > I'm > > > > not sure how to tell from Josm, but it looks like it isn't. I > > > > get > > > > the > > > > messages from shapeSplitter because it
Re: [mkgmap-dev] special case where splitting fails without a log message
Sorry - excess stuff in patch, correct one now. Ticker On Tue, 2021-05-25 at 17:46 +0100, Ticker Berkin wrote: > Hi Gerd > > Patch attached that I hope fixes the splitting problem. > > I haven't looked at your change yet, but your split-failed.osm test > had, and needed, lots of points visited twice and I don't see how > this > can, or should, be avoided. > > Ticker > > On Tue, 2021-05-25 at 15:56 +, Gerd Petermann wrote: > > Hi Ticker, > > > > with the attached patch ShapeMerger avoids to produce shapes where > > more than the start point is visited twice. > > This produces much larger img files (even larger than trunk) but > > PolygonSplitter doesn't complain. > > > > I have to find out what GpsMapEdit means with "has a jitter". Maybe > > only those are problematic. > > > > Gerd > > > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 25. Mai 2021 14:00 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Sorry - sea.zip! > > > > On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote: > > > Hi Gerd > > > > > > I'm getting very confused by this. When I build with my trunk > > > (some > > > filter order changes + a few others), I see a whole lot more that > > > JOSM > > > shows. It and your 6324001.img just show a central bit. Looking > > > with > > > GPSMapEdit with "Highlight Polygon Contours". I also see areas > > > where > > > all islands are inverted. > > > > > > I'll undo my trunk changes and look again. > > > > > > Does JOSM have self-intersection checking? > > > > > > Was the gpx trace hi-res (30bit) and then this kept when > > > generating > > > the > > > osm. If not, then I'd expect problems. > > > > > > Ticker > > > > > > > > > On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I didn't investigate the details. I've created the osm data by > > > > converting a gpx back to osm. I guess in the original input > > > > duplicate > > > > points are identical. I found more such cases where parts are > > > > removed. > > > > > > > > Gerd > > > > > > > > > > > > > > > > Von: mkgmap-dev im > > > > Auftrag > > > > von Ticker Berkin > > > > Gesendet: Dienstag, 25. Mai 2021 12:51 > > > > An: Development list for mkgmap > > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > > without > > > > a log message > > > > > > > > Hi Gerd > > > > > > > > OK - I've reproduced this. Is split-failed.osm self > > > > -intersecting? > > > > I'm > > > > not sure how to tell from Josm, but it looks like it isn't. I > > > > get > > > > the > > > > messages from shapeSplitter because it thinks it is and then > > > > the > > > > result > > > > is not good - as expected. > > > > > > > > I'll investigate more. > > > > > > > > Ticker > > > > > > > > > > > > On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > > > > > Hi Ticker, > > > > > > > > > > while looking at the problems with sea I found this case > > > > > where > > > > > ShapeSplitter removes a small part of an island from a self > > > > > -intersecting polygon in res 24. > > > > > Compiled with mkgmap from trunk, default style and no > > > > > options. > > > > > > > > > > Look at 67.6742611, 14.6783525 > > > > > > > > > > Found this with some check code that compares the area of the > > > > > original polygon with that of sum of the parts. > > > > > > > > > > Gerd > > > > > ___ > > > > > mkgmap-dev mailing list > > > > > mkgmap-dev@lists.mkgmap.org.uk > > > > > https://www.mkgmap
Re: [mkgmap-dev] special case where splitting fails without a log message
Sorry - excess stuff in patch, correct one now. Ticker On Tue, 2021-05-25 at 17:46 +0100, Ticker Berkin wrote: > Hi Gerd > > Patch attached that I hope fixes the splitting problem. > > I haven't looked at your change yet, but your split-failed.osm test > had, and needed, lots of points visited twice and I don't see how > this > can, or should, be avoided. > > Ticker > > On Tue, 2021-05-25 at 15:56 +, Gerd Petermann wrote: > > Hi Ticker, > > > > with the attached patch ShapeMerger avoids to produce shapes where > > more than the start point is visited twice. > > This produces much larger img files (even larger than trunk) but > > PolygonSplitter doesn't complain. > > > > I have to find out what GpsMapEdit means with "has a jitter". Maybe > > only those are problematic. > > > > Gerd > > > > > > > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 25. Mai 2021 14:00 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Sorry - sea.zip! > > > > On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote: > > > Hi Gerd > > > > > > I'm getting very confused by this. When I build with my trunk > > > (some > > > filter order changes + a few others), I see a whole lot more that > > > JOSM > > > shows. It and your 6324001.img just show a central bit. Looking > > > with > > > GPSMapEdit with "Highlight Polygon Contours". I also see areas > > > where > > > all islands are inverted. > > > > > > I'll undo my trunk changes and look again. > > > > > > Does JOSM have self-intersection checking? > > > > > > Was the gpx trace hi-res (30bit) and then this kept when > > > generating > > > the > > > osm. If not, then I'd expect problems. > > > > > > Ticker > > > > > > > > > On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > I didn't investigate the details. I've created the osm data by > > > > converting a gpx back to osm. I guess in the original input > > > > duplicate > > > > points are identical. I found more such cases where parts are > > > > removed. > > > > > > > > Gerd > > > > > > > > > > > > > > > > Von: mkgmap-dev im > > > > Auftrag > > > > von Ticker Berkin > > > > Gesendet: Dienstag, 25. Mai 2021 12:51 > > > > An: Development list for mkgmap > > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > > without > > > > a log message > > > > > > > > Hi Gerd > > > > > > > > OK - I've reproduced this. Is split-failed.osm self > > > > -intersecting? > > > > I'm > > > > not sure how to tell from Josm, but it looks like it isn't. I > > > > get > > > > the > > > > messages from shapeSplitter because it thinks it is and then > > > > the > > > > result > > > > is not good - as expected. > > > > > > > > I'll investigate more. > > > > > > > > Ticker > > > > > > > > > > > > On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > > > > > Hi Ticker, > > > > > > > > > > while looking at the problems with sea I found this case > > > > > where > > > > > ShapeSplitter removes a small part of an island from a self > > > > > -intersecting polygon in res 24. > > > > > Compiled with mkgmap from trunk, default style and no > > > > > options. > > > > > > > > > > Look at 67.6742611, 14.6783525 > > > > > > > > > > Found this with some check code that compares the area of the > > > > > original polygon with that of sum of the parts. > > > > > > > > > > Gerd > > > > > ___ > > > > > mkgmap-dev mailing list > > > > > mkgmap-dev@lists.mkgmap.org.uk > > > > > https://www.mkgmap
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd Patch attached that I hope fixes the splitting problem. I haven't looked at your change yet, but your split-failed.osm test had, and needed, lots of points visited twice and I don't see how this can, or should, be avoided. Ticker On Tue, 2021-05-25 at 15:56 +, Gerd Petermann wrote: > Hi Ticker, > > with the attached patch ShapeMerger avoids to produce shapes where > more than the start point is visited twice. > This produces much larger img files (even larger than trunk) but > PolygonSplitter doesn't complain. > > I have to find out what GpsMapEdit means with "has a jitter". Maybe > only those are problematic. > > Gerd > > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Dienstag, 25. Mai 2021 14:00 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Sorry - sea.zip! > > On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote: > > Hi Gerd > > > > I'm getting very confused by this. When I build with my trunk (some > > filter order changes + a few others), I see a whole lot more that > > JOSM > > shows. It and your 6324001.img just show a central bit. Looking > > with > > GPSMapEdit with "Highlight Polygon Contours". I also see areas > > where > > all islands are inverted. > > > > I'll undo my trunk changes and look again. > > > > Does JOSM have self-intersection checking? > > > > Was the gpx trace hi-res (30bit) and then this kept when generating > > the > > osm. If not, then I'd expect problems. > > > > Ticker > > > > > > On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > I didn't investigate the details. I've created the osm data by > > > converting a gpx back to osm. I guess in the original input > > > duplicate > > > points are identical. I found more such cases where parts are > > > removed. > > > > > > Gerd > > > > > > > > > > > > Von: mkgmap-dev im > > > Auftrag > > > von Ticker Berkin > > > Gesendet: Dienstag, 25. Mai 2021 12:51 > > > An: Development list for mkgmap > > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > > without > > > a log message > > > > > > Hi Gerd > > > > > > OK - I've reproduced this. Is split-failed.osm self-intersecting? > > > I'm > > > not sure how to tell from Josm, but it looks like it isn't. I get > > > the > > > messages from shapeSplitter because it thinks it is and then the > > > result > > > is not good - as expected. > > > > > > I'll investigate more. > > > > > > Ticker > > > > > > > > > On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > > > > Hi Ticker, > > > > > > > > while looking at the problems with sea I found this case where > > > > ShapeSplitter removes a small part of an island from a self > > > > -intersecting polygon in res 24. > > > > Compiled with mkgmap from trunk, default style and no options. > > > > > > > > Look at 67.6742611, 14.6783525 > > > > > > > > Found this with some check code that compares the area of the > > > > original polygon with that of sum of the parts. > > > > > > > > Gerd > > > > ___ > > > > mkgmap-dev mailing list > > > > mkgmap-dev@lists.mkgmap.org.uk > > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, with the attached patch ShapeMerger avoids to produce shapes where more than the start point is visited twice. This produces much larger img files (even larger than trunk) but PolygonSplitter doesn't complain. I have to find out what GpsMapEdit means with "has a jitter". Maybe only those are problematic. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Dienstag, 25. Mai 2021 14:00 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Sorry - sea.zip! On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote: > Hi Gerd > > I'm getting very confused by this. When I build with my trunk (some > filter order changes + a few others), I see a whole lot more that > JOSM > shows. It and your 6324001.img just show a central bit. Looking with > GPSMapEdit with "Highlight Polygon Contours". I also see areas where > all islands are inverted. > > I'll undo my trunk changes and look again. > > Does JOSM have self-intersection checking? > > Was the gpx trace hi-res (30bit) and then this kept when generating > the > osm. If not, then I'd expect problems. > > Ticker > > > On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > > Hi Ticker, > > > > I didn't investigate the details. I've created the osm data by > > converting a gpx back to osm. I guess in the original input > > duplicate > > points are identical. I found more such cases where parts are > > removed. > > > > Gerd > > > > > > ________________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 25. Mai 2021 12:51 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > OK - I've reproduced this. Is split-failed.osm self-intersecting? > > I'm > > not sure how to tell from Josm, but it looks like it isn't. I get > > the > > messages from shapeSplitter because it thinks it is and then the > > result > > is not good - as expected. > > > > I'll investigate more. > > > > Ticker > > > > > > On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > while looking at the problems with sea I found this case where > > > ShapeSplitter removes a small part of an island from a self > > > -intersecting polygon in res 24. > > > Compiled with mkgmap from trunk, default style and no options. > > > > > > Look at 67.6742611, 14.6783525 > > > > > > Found this with some check code that compares the area of the > > > original polygon with that of sum of the parts. > > > > > > Gerd > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev no-self-is.patch Description: no-self-is.patch ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Sorry - sea.zip! On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote: > Hi Gerd > > I'm getting very confused by this. When I build with my trunk (some > filter order changes + a few others), I see a whole lot more that > JOSM > shows. It and your 6324001.img just show a central bit. Looking with > GPSMapEdit with "Highlight Polygon Contours". I also see areas where > all islands are inverted. > > I'll undo my trunk changes and look again. > > Does JOSM have self-intersection checking? > > Was the gpx trace hi-res (30bit) and then this kept when generating > the > osm. If not, then I'd expect problems. > > Ticker > > > On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > > Hi Ticker, > > > > I didn't investigate the details. I've created the osm data by > > converting a gpx back to osm. I guess in the original input > > duplicate > > points are identical. I found more such cases where parts are > > removed. > > > > Gerd > > > > > > ____________ > > Von: mkgmap-dev im Auftrag > > von Ticker Berkin > > Gesendet: Dienstag, 25. Mai 2021 12:51 > > An: Development list for mkgmap > > Betreff: Re: [mkgmap-dev] special case where splitting fails > > without > > a log message > > > > Hi Gerd > > > > OK - I've reproduced this. Is split-failed.osm self-intersecting? > > I'm > > not sure how to tell from Josm, but it looks like it isn't. I get > > the > > messages from shapeSplitter because it thinks it is and then the > > result > > is not good - as expected. > > > > I'll investigate more. > > > > Ticker > > > > > > On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > > > Hi Ticker, > > > > > > while looking at the problems with sea I found this case where > > > ShapeSplitter removes a small part of an island from a self > > > -intersecting polygon in res 24. > > > Compiled with mkgmap from trunk, default style and no options. > > > > > > Look at 67.6742611, 14.6783525 > > > > > > Found this with some check code that compares the area of the > > > original polygon with that of sum of the parts. > > > > > > Gerd > > > ___ > > > mkgmap-dev mailing list > > > mkgmap-dev@lists.mkgmap.org.uk > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd I'm getting very confused by this. When I build with my trunk (some filter order changes + a few others), I see a whole lot more that JOSM shows. It and your 6324001.img just show a central bit. Looking with GPSMapEdit with "Highlight Polygon Contours". I also see areas where all islands are inverted. I'll undo my trunk changes and look again. Does JOSM have self-intersection checking? Was the gpx trace hi-res (30bit) and then this kept when generating the osm. If not, then I'd expect problems. Ticker On Tue, 2021-05-25 at 11:18 +, Gerd Petermann wrote: > Hi Ticker, > > I didn't investigate the details. I've created the osm data by > converting a gpx back to osm. I guess in the original input duplicate > points are identical. I found more such cases where parts are > removed. > > Gerd > > > > Von: mkgmap-dev im Auftrag > von Ticker Berkin > Gesendet: Dienstag, 25. Mai 2021 12:51 > An: Development list for mkgmap > Betreff: Re: [mkgmap-dev] special case where splitting fails without > a log message > > Hi Gerd > > OK - I've reproduced this. Is split-failed.osm self-intersecting? I'm > not sure how to tell from Josm, but it looks like it isn't. I get the > messages from shapeSplitter because it thinks it is and then the > result > is not good - as expected. > > I'll investigate more. > > Ticker > > > On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > > Hi Ticker, > > > > while looking at the problems with sea I found this case where > > ShapeSplitter removes a small part of an island from a self > > -intersecting polygon in res 24. > > Compiled with mkgmap from trunk, default style and no options. > > > > Look at 67.6742611, 14.6783525 > > > > Found this with some check code that compares the area of the > > original polygon with that of sum of the parts. > > > > Gerd > > ___ > > mkgmap-dev mailing list > > mkgmap-dev@lists.mkgmap.org.uk > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, I didn't investigate the details. I've created the osm data by converting a gpx back to osm. I guess in the original input duplicate points are identical. I found more such cases where parts are removed. Gerd Von: mkgmap-dev im Auftrag von Ticker Berkin Gesendet: Dienstag, 25. Mai 2021 12:51 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] special case where splitting fails without a log message Hi Gerd OK - I've reproduced this. Is split-failed.osm self-intersecting? I'm not sure how to tell from Josm, but it looks like it isn't. I get the messages from shapeSplitter because it thinks it is and then the result is not good - as expected. I'll investigate more. Ticker On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > Hi Ticker, > > while looking at the problems with sea I found this case where > ShapeSplitter removes a small part of an island from a self > -intersecting polygon in res 24. > Compiled with mkgmap from trunk, default style and no options. > > Look at 67.6742611, 14.6783525 > > Found this with some check code that compares the area of the > original polygon with that of sum of the parts. > > Gerd > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] special case where splitting fails without a log message
Hi Gerd OK - I've reproduced this. Is split-failed.osm self-intersecting? I'm not sure how to tell from Josm, but it looks like it isn't. I get the messages from shapeSplitter because it thinks it is and then the result is not good - as expected. I'll investigate more. Ticker On Tue, 2021-05-25 at 10:04 +, Gerd Petermann wrote: > Hi Ticker, > > while looking at the problems with sea I found this case where > ShapeSplitter removes a small part of an island from a self > -intersecting polygon in res 24. > Compiled with mkgmap from trunk, default style and no options. > > Look at 67.6742611, 14.6783525 > > Found this with some check code that compares the area of the > original polygon with that of sum of the parts. > > Gerd > ___ > mkgmap-dev mailing list > mkgmap-dev@lists.mkgmap.org.uk > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] special case where splitting fails without a log message
Hi Ticker, while looking at the problems with sea I found this case where ShapeSplitter removes a small part of an island from a self-intersecting polygon in res 24. Compiled with mkgmap from trunk, default style and no options. Look at 67.6742611, 14.6783525 Found this with some check code that compares the area of the original polygon with that of sum of the parts. Gerd split-failed.osm Description: split-failed.osm 63240001.img Description: 63240001.img ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev