[josm-dev] Clockwise coastline, anti-clockwise water
Hello, I try to verify patch http://josm.openstreetmap.de/ticket/737 Now beside the fact, that this contains an better algorithm for clockwise coastline detection, it also fixes a set of problems in the old code. Now the result is, that the code works as expected and reports "clockwise coastline" and "clockwise land" as error. But it also reports "anti-clockwise water" as error. There is no doubt, that the original code wanted to do that also, but I found not indication on the website why? So my questions. Should water be drawn clockwise or anti-clockwise, or can the check be removed? Ciao -- http://www.dstoecker.eu/ (PGP key available) ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Clockwise coastline, anti-clockwise water
Dirk, http://wiki.openstreetmap.org/index.php/Tag:natural%3Dwater clearly states water should be drawn with land on the left and water on the right side ie clockwise. And hence counter-clockwise for land. My understanding is that this is required for the case of large bodies of waters or large islands composed of more than one way. (Although the test is only applied for a single closed way) I just looked at the patch again, and although I corrected the if statements, the error messages are wrong for coastline and water. I think that errortype should be "Anti-clockwise coastline" and "Anti-clockwise water". Regards, Roy Rankin Dirk Stöcker wrote: > Hello, > > I try to verify patch http://josm.openstreetmap.de/ticket/737 > > Now beside the fact, that this contains an better algorithm for clockwise > coastline detection, it also fixes a set of problems in the old code. > > Now the result is, that the code works as expected and reports "clockwise > coastline" and "clockwise land" as error. But it also reports "anti-clockwise > water" as error. There is no doubt, that the original code wanted to do > that also, but I found not indication on the website why? > > So my questions. Should water be drawn clockwise or anti-clockwise, or can > the check be removed? > > Ciao ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Clockwise coastline, anti-clockwise water
On Mon, 7 Jul 2008, Roy Rankin wrote: > http://wiki.openstreetmap.org/index.php/Tag:natural%3Dwater clearly > states water should be drawn with land on the left and water on the > right side ie clockwise. And hence counter-clockwise for land. My > understanding is that this is required for the case of large bodies of > waters or large islands composed of more than one way. (Although the > test is only applied for a single closed way) > > I just looked at the patch again, and although I corrected the if > statements, the error messages are wrong for coastline and water. I > think that errortype should be "Anti-clockwise coastline" and > "Anti-clockwise water". Actually that is not, what the code does. It checks for anti-clockwise coastline anti-clockwise land clockwise water. The problem is probably in semantics: http://wiki.openstreetmap.org/index.php/Tag:natural=coastline States as anti-clockwise, but regarding the land surrounded by water http://wiki.openstreetmap.org/index.php/Tag:natural=water States clockwise, but regarding the water itself and not the land. Thus it seems the code must be fixed to handle coastline equal to water. And I will change the text, so it uses right and left instead of clockwise. Now the remaining questions is natural=land. When should land be in this case? natural=water --> land left natural=coastline --> land left natural=land --> land left? or natural=water --> tagged element (water) right natural=coastline --> tagged element (sea) right natural=land --> tagged element (land) right ? Other comments? Ciao -- http://www.dstoecker.eu/ (PGP key available) ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Clockwise coastline, anti-clockwise water
2008/7/6 Dirk Stöcker <[EMAIL PROTECTED]>: > Hello, > > I try to verify patch http://josm.openstreetmap.de/ticket/737 > > Now beside the fact, that this contains an better algorithm for clockwise > coastline detection, it also fixes a set of problems in the old code. > > Now the result is, that the code works as expected and reports "clockwise > coastline" and "clockwise land" as error. But it also reports > "anti-clockwise > water" as error. There is no doubt, that the original code wanted to do > that also, but I found not indication on the website why? > > So my questions. Should water be drawn clockwise or anti-clockwise, or can > the check be removed? > Coastline should be clockwise, around the water, typically you wouldn't have an entire sea of ocean closed area loaded into JOSM though, but, you could well have islands in even a small area... Islands are represented by a hole in the water, or an anticlockwise closed area... The check reporting an error is due to the fact that if an island was drawn with a clockwise coastline, it would be representing the water... Also, a lake/pond, should be water rather than coastline so it would flag this too... Land should be a/some clockwise way/ways around land and water should be a/some clockwise way/ways around water... So, it should be an error if the way is anticlockwise... ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
[josm-dev] Automatic tag correction
Hi, I've been playing around with JOSM for a bit as a pratice to improve my Java skills. One thing I noticed on the OSM lists and wiki, is the problem that some tagging proposals aren't accepted because the suggested tags are dependend on the direction of the way, for example tagging of features that are different on the "left" and "right" side of the way, which easily can lead to corrupted/wrong data if the way is reversed without adjusting them. That's why I've attemped implement a "tag corrector" feature, that suggests corrections to tags when a way is reversed. Currently it covers "oneway" and tags that start with "left:" or "right:" or end with ":left" and ":right", for example as used on borders. I've set it up in a way that allows to use the functionalty elsewhere, for example if there were a tag that where problematic when splitting a way. I've attached a patch, with the hope that someone could give their opinion on the idea in general and my implementation in particular. A next step would be to have corrections of relations in a simular manner. Robin Index: src/org/openstreetmap/josm/actions/ReverseWayAction.java === --- src/org/openstreetmap/josm/actions/ReverseWayAction.java(revision 682) +++ src/org/openstreetmap/josm/actions/ReverseWayAction.java(working copy) @@ -15,6 +15,7 @@ import org.openstreetmap.josm.command.ChangeCommand; import org.openstreetmap.josm.command.Command; import org.openstreetmap.josm.command.SequenceCommand; +import org.openstreetmap.josm.data.corrector.ReverseWayTagCorrector; import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitive; @@ -46,13 +47,20 @@ tr("Please select at least one way.")); return; } - Collection c = new LinkedList(); - for (Way w : sel) { - Way wnew = new Way(w); + + boolean updateProperties = false; + ReverseWayTagCorrector reverseWayTagCorrector = new ReverseWayTagCorrector(); + Collection c = new LinkedList(); + for (Way w : sel) { + Way wnew = new Way(w); Collections.reverse(wnew.nodes); - c.add(new ChangeCommand(w, wnew)); - } - Main.main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c)); - Main.map.repaint(); + updateProperties = reverseWayTagCorrector.execute(w) || updateProperties; + c.add(new ChangeCommand(w, wnew)); + } + Main.main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c)); + if (updateProperties) { + // selectionChanged(Main.ds.getSelected()); + } + } } Index: src/org/openstreetmap/josm/data/corrector/TagCorrection.java === --- src/org/openstreetmap/josm/data/corrector/TagCorrection.java (revision 0) +++ src/org/openstreetmap/josm/data/corrector/TagCorrection.java (revision 0) @@ -0,0 +1,41 @@ +// License: GPL. For details, see LICENSE file. +package org.openstreetmap.josm.data.corrector; + +public class TagCorrection { + + private final String oldKey; + private final String newKey; + private final String oldValue; + private final String newValue; + + public TagCorrection(String oldKey, String oldValue, String newKey, String newValue) { + this.oldKey = oldKey; + this.oldValue = oldValue; + this.newKey = oldKey; + this.newValue = newValue; + } + + public String getOldKey() { + return oldKey; +} + + public String getOldValue() { + return oldValue; +} + + public String getNewKey() { + return newKey; +} + + public String getNewValue() { + return newValue; +} + + public boolean isKeyChanged() { + return !newKey.equals(oldKey); + } + + public boolean isValueChanged() { + return !newValue.equals(oldValue); + } +} Index: src/org/openstreetmap/josm/data/corrector/ReverseWayTagCorrector.java === --- src/org/openstreetmap/josm/data/corrector/ReverseWayTagCorrector.java (revision 0) +++ src/org/openstreetmap/josm/data/corrector/ReverseWayTagCorrector.java (revision 0) @@ -0,0 +1,58 @@ +// License: GPL. For details, see LICENSE file. +package org.openstreetmap.josm.data.corrector; + +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openstreetmap.josm.data.osm.OSMUtils; +import org.openstreetmap.josm.data.osm.Way; + +public class ReverseWayTagCorrector extends TagCorrector { + + privat
Re: [josm-dev] Automatic tag correction
Hi, Am Sonntag, 6. Juli 2008 schrieb Robin Rattay: > That's why I've attemped implement a "tag corrector" feature, that I really like that feature and think we should include it. > I've set it up in a way that allows to use the functionalty elsewhere, [...] > A next step would be to have corrections of relations in a simular > manner. Yes, but I fear, this is not possible in such a easy and straight forward manner. About your patch: Class TagCorrection, is not the way data structures are implemented in JOSM so far (atm there are public fields everywhere!), but I really like the suggestion. The TagCorrections don't seem to be undoable, right? - this should be implemented. There are some tags like cycleway=opposite_lane, these should be adapted similar. Maybe TagCorrectionTable should better be placed in the gui subpackage. Rapha ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Automatic tag correction
On Sun, 6 Jul 2008, Robin Rattay wrote: > I've attached a patch, with the hope that someone could give their > opinion on the idea in general and my implementation in particular. Idea in general is very nice. Implementation probably has some problems to be fixed, but I'm not yet the one to comment on these :-) Ciao -- http://www.dstoecker.eu/ (PGP key available) ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Automatic tag correction
Dirk Stöcker schrieb: > Idea in general is very nice. Thank you. > Implementation probably has some problems > to be fixed, but I'm not yet the one to comment on these :-) Go ahead. I'll take any criticism. Robin ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Automatic tag correction
Raphael Mack schrieb: > Am Sonntag, 6. Juli 2008 schrieb Robin Rattay: >> That's why I've attemped implement a "tag corrector" feature, that > > I really like that feature and think we should include it. Thank you. >> A next step would be to have corrections of relations in a simular >> manner. > > Yes, but I fear, this is not possible in such a easy and straight forward > manner. True. > About your patch: > Class TagCorrection, is not the way data structures are implemented in JOSM > so far (atm there are public fields everywhere!), but I really like the > suggestion. You mean I should use public fields? Well, the access methods *is* the correct way :-) but on the other hand it's such a simple "record class" so public fields are probably ok here. > The TagCorrections don't seem to be undoable, right? - this should be > implemented. Not directly, but each use can implement it. For reverse way the existing ChangeCommand is used, and in other cases a ChangePropertyCommand can be used. > There are some tags like cycleway=opposite_lane, these should be adapted > similar. Unfortunatly there is not opposite to that. If my feature catches on, then we could define tags like cycleway:left=lane that can be corrected to cycleway:right=lane. > Maybe TagCorrectionTable should better be placed in the gui subpackage. I considered that, but I prefered to keep all the corrector classes together. Maybe it just should be moved out of the data package. Thank you for your input! Robin ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Clockwise coastline, anti-clockwise water
Dirk Stöcker wrote: > On Mon, 7 Jul 2008, Roy Rankin wrote: > >> I just looked at the patch again, and although I corrected the if >> statements, the error messages are wrong for coastline and water. I >> think that errortype should be "Anti-clockwise coastline" and >> "Anti-clockwise water". > > Actually that is not, what the code does. > > It checks for > > anti-clockwise coastline > anti-clockwise land > clockwise water. > > The problem is probably in semantics: Opps, I missed the fact that when talking on the direction of coastlines, anti-clockwise is relative to the land and thus the test is incorrect concerning coastlines. > > http://wiki.openstreetmap.org/index.php/Tag:natural=coastline > States as anti-clockwise, but regarding the land surrounded by water > > http://wiki.openstreetmap.org/index.php/Tag:natural=water > States clockwise, but regarding the water itself and not the land. > > Thus it seems the code must be fixed to handle coastline equal to > water. And I will change the text, so it uses right and left > instead of clockwise. > > Now the remaining questions is natural=land. When should land be in this > case? > natural=water --> land left > natural=coastline --> land left > natural=land --> land left? For natural=[water, land, coastline] the rule is always "land on left water of right" when facing in the direction of the way. The land rule is in http://wiki.openstreetmap.org/index.php/Map_Features#Natural. Which would make the above correct. How does the following sound for errortype water - land not on left land - land not on left coastline - land not on left Regards, Roy Rankin ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
Re: [josm-dev] Some relation handling stuff
Hi, > BTW: Could someone please fix #913 and #716 (refresh of relation display > and data display) in case of nely arrived data Done. Bye Frederik -- Frederik Ramm ## eMail [EMAIL PROTECTED] ## N49°00'09" E008°23'33" ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev