[Potlatch-dev] [OpenStreetMap] #4539: Endpoints of node networks are incorrectly detected

OpenStreetMap trac at openstreetmap.org
Thu Aug 23 14:16:00 BST 2012


#4539: Endpoints of node networks are incorrectly detected
-------------------------------------+--------------------------------------
 Reporter:  JDub                     |       Owner:  potlatch-dev@…                
     Type:  defect                   |      Status:  new                           
 Priority:  trivial                  |   Milestone:                                
Component:  potlatch2                |     Version:                                
 Keywords:  rcn, node, display name  |  
-------------------------------------+--------------------------------------

Comment(by JDub):

 How I reproduce the error:

 * Open my link above, then Edit -> Potlatch2

 * Without zooming, select way 73579617, the small connection between the
 road and the bike path.

 * Select advanced view. One relation is listed as using this way, namely
 "Route bycicle rcn -60", id 6115. The end points of this relation are
 872014261 [rcn_ref=75] and (off-screen) 60457713 [network=rcn, rcn_ref=73,
 rwn_ref=69]

 * If I stay in simple view but try to add this way to a cycle route, I get
 three options in the resulting window: "13186: route bicycle rcn 75-",
 "6115: route bicycle rcn -60" and "6119: route bicycle rcn -75". All three
 of these meet in rcn node 75.

 If I zoom out enough that rcn node 73 is in the picture, and wait for my
 computer to stop swapping (it's a laptop), relation 6115 is reported as
 "route bicycle rcn 73-60". This is despite that it correctly recognizes
 that short segment ending on rcn node 75 as the last one of the relation
 (6115/28 for 29 members)

 It shows you that relation as "route bicycle rcn -75"?

 Took a look at the code, and here's my understanding of what's going
 wrong:

 Relation 6115 is loaded, as is its last member way 6115/28 and this way's
 two end nodes 872014261 and 16652149. Calling getDescription(6115) then
 calls getSignificantName(6115/28), which in turn first tries
 getSignificantName(16652149) and then, if this gives no result,
 getSignificantName(872014261) which should be "75".

 However, node 16652149 is rwn node 60, so getSignificantName(16652149)
 returns "60". The problem is that getDescription takes the a node of last
 way but not necessarily the last node of the relation. Reversing the
 direction of the way would fix it for the -75 routes, but this might not
 fix other, busier intersections.

 getSignificantName(<way>) either needs a flag indicating which end to
 check, or the relation needs to be able to directly find the first and
 last *nodes* and call getSignificantName (or maybe just the needed regex)
 on them directly.

 I'm not familiar with ActionScript, but what about something like this,
 replacing lines 149-151:


 {{{
 var firstName:String = '';
 if (getFirstMember() is Way) {
     if (Way(getMember(0)).getFirstNode()==Way(getMember(1)).getFirstNode()
 || Way(getMember(0)).getFirstNode()==Way(getMember(1)).getLastNode()) {
         firstName = getSignificantName(Way(getMember(0)).getLastNode());
     } else {
         firstName = getSignificantName(Way(getMember(0)).getfirstNode());
     }
 } else if (getFirstMember() is Node) {
     firstName = getSignificantName(getFirstMember());
 }

 var lastName:String = '';
 if (getLastMember() is Way) {
     var len:Number = length() - 1;
     if
 (Way(getMember(len)).getFirstNode()==Way(getMemler(len-1)).getFirstNode()
 ||
 Way(getMember(len)).getFirstNode()==Way(getMember(len-1)).getLastNode()) {
         lastName = getSignificantName(Way(getMember(len)).getLastNode());
     } else {
         lastName = getSignificantName(Way(getMember(len)).getfirstNode());
     }
 } else if (getLastMember() is Node) {
     lastName = getSignificantName(getLastMember());
 }

 if ((firstName+lastName)!='') desc+=" "+firstName+"-"+lastName;
 }}}

 There's probably a more elegant way to code this, but this way should work
 at least.

-- 
Ticket URL: <https://trac.openstreetmap.org/ticket/4539#comment:5>
OpenStreetMap <http://www.openstreetmap.org/>
OpenStreetMap is a free editable map of the whole world



More information about the Potlatch-dev mailing list