Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A) Test Way Name Swap
There is an edge case in deciding significance of names. In Russia, "Foo Street" and "Street Foo" are the same, and so if a decliner adds a street name and reversed by an agreer, the name should be removed. Currently the bot treats "Street Foo" as a distinct name, and so keeps it.
history = [OSM::Way[[1,2,3], :id=>1, :changeset=>1, :version=>1, "highway"=>"residental"], # created by agreer
OSM::Way[[1,2,3], :id=>1, :changeset=>3, :version=>2, "highway"=>"residental", "name"=>"ул. Гая"], # name added by decliner
OSM::Way[[1,2,3], :id=>1, :changeset=>2, :version=>3, "highway"=>"residental", "name"=>"Гая ул."]] # name swapped around by agreer
Expected
[Edit[obj=OSM::Way[[1, 2, 3],:element_id=>1,:changeset_id=>-1,:timestamp=>,:visible=>true,:version=>3,"highway"=>"residental"]],
Redact[klass=OSM::Way,element_id=1,version=2,mode=:hidden],
Redact[klass=OSM::Way,element_id=1,version=3,mode=:visible]],
not
[Redact[klass=OSM::Way,element_id=1,version=2,mode=:hidden]].
B) Test Way Reversed By Decliner
The geometry processing needed to figure out what state to leave a road in (after figuring out what nodes need expunging) is complex and doesn't handle every situation. Matt recently re-wrote it fully, and it now covers all situations bar one. In this case, the order of the outputted nodes isn't ideal - the "unreversing" of the way is being done to the nodes that were in the way at the time it was reversed, ignoring the later node. Matt reckons fixing this could involve a considerable about of work - adding a fourth type of geometry processing to the three the bot already recognises.
history = [OSM::Way[[1,2 ], :id=>1, :changeset=>1, :version=>1, "oneway"=>"-1"], # created by agreer
OSM::Way[[2,1 ], :id=>1, :changeset=>3, :version=>2, "oneway"=>"yes"], # way reversed by decliner
OSM::Way[[3,2,1], :id=>1, :changeset=>2, :version=>3, "oneway"=>"yes"]] # node added by agreer
Expected
[Edit[obj=OSM::Way[[1, 2, 3],:element_id=>1,:changeset_id=>-1,:timestamp=>,:visible=>true,:version=>3,"oneway"=>"-1"]],
Redact[klass=OSM::Way,element_id=1,version=2,mode=:hidden],
Redact[klass=OSM::Way,element_id=1,version=3,mode=:visible]],
not
[Edit[obj=OSM::Way[[3, 1, 2],:element_id=>1,:changeset_id=>-1,:timestamp=>,:visible=>true,:version=>3,"oneway"=>"-1"]],
Redact[klass=OSM::Way,element_id=1,version=2,mode=:hidden],
Redact[klass=OSM::Way,element_id=1,version=3,mode=:visible]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment