Issue 140 in osmeditor4android: Many time addr:street fail to guess the nearest way

8 views
Skip to first unread message

osmedito...@googlecode.com

unread,
Nov 25, 2012, 8:50:48 AM11/25/12
to osmedito...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 140 by stefano....@gmail.com: Many time addr:street fail to guess
the nearest way
http://code.google.com/p/osmeditor4android/issues/detail?id=140

What steps will reproduce the problem?
1. select a node of a building
2. add an addr:street tag
3. many time the software does not choose the nearest way

What is the expected output? What do you see instead?
Vespucci should choose the nearest way

What version of the product are you using? On what operating system?
Samsung Galaxy W with Android 2.3.6, Vespucci 0.8.1r402

Please provide any additional information below.
In my tests, if I add 2 addresses on the same building, the second address
has always a bad addr:street tag. The first tag, sometime is good, sometime
not. I have done my tests on nodes that have near only 1 way (no
intersection).

osmedito...@googlecode.com

unread,
Nov 25, 2012, 9:01:59 AM11/25/12
to osmedito...@googlegroups.com

Comment #1 on issue 140 by Marcus.W...@gmail.com: Many time addr:street
Do the reported names belong to the nearest node of a way but not the
nearest way?

osmedito...@googlecode.com

unread,
Nov 25, 2012, 9:46:04 AM11/25/12
to osmedito...@googlegroups.com

Comment #2 on issue 140 by stefano....@gmail.com: Many time addr:street
No, I show you. See the attachment: on the left I have a building with a
red and green circle. Near this building you have the nearest node of a way
(Via Casoni).
I add the address on the red node and Vespucci told me "Via Casoni"
(correct in this case). I add the address on the green node and Vespucci
told me "Via Giovanni Visintin" (not correct).

I add the address on the blue node and Vespucci told me "Via Casoni"
(correct in this case). I add the address on the violet node and Vespucci
told me "Via 27 Aprile" (not correct, is much far from this point).

For the first node, maybe you are right but I'm not sure. The second node
on the same building seems to be always bad.

Attachments:
Schermata.png 232 KB

osmedito...@googlecode.com

unread,
Nov 26, 2012, 1:49:08 AM11/26/12
to osmedito...@googlegroups.com

Comment #3 on issue 140 by stefano....@gmail.com: Many time addr:street
I forget the url of the previous image:
http://www.openstreetmap.org/?lat=45.71001&lon=11.93392&zoom=17&layers=M

osmedito...@googlecode.com

unread,
Nov 26, 2012, 1:55:10 AM11/26/12
to osmedito...@googlegroups.com
Updates:
Status: Accepted
Owner: Marcus.W...@gmail.com

Comment #4 on issue 140 by Marcus.W...@gmail.com: Many time addr:street
(No comment was entered for this change.)

osmedito...@googlecode.com

unread,
Nov 26, 2012, 1:59:20 AM11/26/12
to osmedito...@googlegroups.com

Comment #5 on issue 140 by stefano....@gmail.com: Many time addr:street
The first node of a building is not always good (and the second is not
always bad): I show you.

http://www.openstreetmap.org/?lat=45.70897&lon=11.932582&zoom=18&layers=M

1. add addr:street on red circle (Via Montello) = OK
2. add addr:street on green circle (Via Montello) = strange but OK
3. add addr:street on orange circle (Via John Fitzgerald Kennedy) = BAD

Hope this helps

Attachments:
Schermata.png 270 KB

osmedito...@googlecode.com

unread,
Jan 18, 2013, 7:50:45 AM1/18/13
to osmedito...@googlegroups.com

Comment #6 on issue 140 by stefano....@gmail.com: Many time addr:street
Can you check the code at Util\GeoMath.java:237 ? (equation 14)
If you see this link:
http://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line

the sample code in Java should be equal to your code... but is different!
Maybe the routine that calculate the distance of point to a line is buggy.

osmedito...@googlecode.com

unread,
Jan 19, 2013, 12:34:39 AM1/19/13
to osmedito...@googlegroups.com

Comment #7 on issue 140 by andrew.g...@gmail.com: Many time addr:street
The normalLength part of the two matches, so it's the difference between::

abs((P.x - A.x) * (B.y - A.y) - (P.y - A.y) * (B.x - A.x))
and the Vespucci code (using Wikipedia names):
abs((B.x - A.x) * (A.Y - P.y) - (A.x - P.x) * (B.y - A.y))

I'll transform the Vespucci code one step at a time:
1. Swap the two sides of the middle subtraction to get (B.y-A.y) and
(B.x-A.x) on the same side as Wikipedia:
abs(-(A.x - P.x) * (B.y - A.y) + (B.x - A.x) * (A.y - P.y))
2. Swap the two sides of the two (A-P) operations:
abs(-(-(P.x - A.x)) * (B.y - A.y) + (B.x - A.x) * -(P.y - A.y))
3. The two minus signs at the left cancel each other out, and the two parts
of the right multiplication can switch places:
abs((P.x - A.x) * (B.y - A.y) - (P.y - A.y) * (B.x - A.x))
4. Which is the same as the Wikipedia equation!

osmedito...@googlecode.com

unread,
Jan 19, 2013, 12:39:00 AM1/19/13
to osmedito...@googlegroups.com

Comment #8 on issue 140 by andrew.g...@gmail.com: Many time addr:street
Step 2 might be confusing. It's doing (A-P) ==> -(P-A)
Step 3 is similar: + M * -N ==> - N * M

osmedito...@googlecode.com

unread,
Jan 19, 2013, 5:20:36 AM1/19/13
to osmedito...@googlegroups.com

Comment #9 on issue 140 by Marcus.W...@gmail.com: Many time addr:street
Did you try the change in the code?

osmedito...@googlecode.com

unread,
Jan 19, 2013, 9:21:16 AM1/19/13
to osmedito...@googlegroups.com

Comment #10 on issue 140 by andrew.g...@gmail.com: Many time addr:street
What change? The existing code is identical to the formula on the Wolfram
page <http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html>,
which I've proven is mathematically identical to the Wikipedia code. Are
you suggesting the Wolfram page is wrong?

To paraphrase things, one site is saying A*B, the other one B*A. It's the
same formula.

osmedito...@googlecode.com

unread,
Jan 19, 2013, 10:42:19 AM1/19/13
to osmedito...@googlegroups.com

Comment #11 on issue 140 by Marcus.W...@gmail.com: Many time addr:street
Sorry, it read like P and A where confused.
Strange that this didn's work correctly.


osmedito...@googlecode.com

unread,
Jan 19, 2013, 12:15:44 PM1/19/13
to osmedito...@googlegroups.com
Updates:
Status: Fixed

Comment #12 on issue 140 by andrew.g...@gmail.com: Many time addr:street
Fixed in r417. In short, the point-line distance calculation was based on
an infinite line aligned on the node1->node2 line. The new calculation
stops at the given end points.

Reply all
Reply to author
Forward
0 new messages