<br><br><div><span class="gmail_quote">On 6/19/07, <b class="gmail_sendername">Dave Hansen</b> <<a href="mailto:dave@sr71.net">dave@sr71.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 2007-06-19 at 10:07 +0100, Andy Robinson wrote:<br>> Dave Hansen wrote:<br>> >Sent: 19 June 2007 1:06 AM<br>> >To: Brandon Martin-Anderson<br>> >Cc: <a href="mailto:dev@openstreetmap.org">dev@openstreetmap.org
</a>; Alex Mauer<br>> >Subject: Re: [OSM-dev] TIGER import.rb<br>> ><br>> >I've noticed a few weird looking ways, like that the nodes aren't being<br>> >connected in the right order.  I've traced it down enough to see that by
<br>> >the time the data gets to Dataset::to_osm(), it is already bogus.  So, I<br>> >think if there's an error, it's in the TIGER parsing code.<br>> ><br>> >Although, I guess it could just be faulty TIGER data to begin with.
<br>> ><br>> >Check out this .osm file:<br>> ><br>> >     <a href="http://sr71.net/~dave/foo/TGR18115.osm.xml.gz">http://sr71.net/~dave/foo/TGR18115.osm.xml.gz</a><br>> ><br>><br>> I took a look over this file in a little more detail and have a couple of
<br>> observations which I hope are constructive:<br>><br>> 1. A power line that runs through the area on a line SSW to NNE appears to<br>> have short spurs that I guess are the local distributor from the main power
<br>> line. These and the actual power line itself currently connect themselves to<br>> nodes on the highway network. Perhaps this is because in the TIGER data they<br>> share the same node co-ords. I'd suggest that the reuse of nodes be limited
<br>> to each separate TIGER data type and not across data types. Would this throw<br>> up any other issues?<br><br>It turns out that JOSM will take nodes that have the exact same<br>coordinates and negative ids, and combine them into a single node.  I've
<br>managed to get the data produced to have two distinct nodes at the same<br>location for the example you provided, with the power line crossing the<br>road.  However, I've had to assign positive ids to the OSM objects.
<br>Is there any way to get JOSM to stop this behavior?  I guess we could<br>detect when we have two nodes in the same place and just add some small,<br>random, floating point value to the coordinates.</blockquote><div><br>
We'll have to make sure JOSM can turn that behavior off, for the alternative is a tremendous kludge.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
ids <= 0 are interpreted by the server to tell it to fill in the id when<br>it is inserted into the database, right?<br><br>> 2. The aggregation of segments into ways results in some instances in some<br>> strange way patterns. Is this perhaps because there is insufficient
<br>> information in the TIGER data to differentiate where one logical way ends<br>> and the next starts? Perhaps it might be worth seeing if splitting a way<br>> where it makes a major change in direction (say greater than 60 degrees)
<br>> improves things. This should be applied only where the change in direction<br>> occurs at a junction with another way.<br><br>Right now, there's no real geometry calculations in the whole thing.  Is<br>there any ruby code for doing the angle calculations handy somewhere?
</blockquote><div><br>I'm no sure what the exact definition of a Way is; my interpretation is that it is a string of street segments that a nonexpert would identify as a single road. Typically, this means all consecutive segments with the same name. There are cases when a single, coherent street makes a hard turn at an intersection. I can think of several, mostly state highways traveling through the middle of a small town. So I don't support the idea that a hard angle in a Way should split the way. But because I happen to know the answer to your question and I like to look smart, here it is:
<br><br>A and B are vectors.<br>A dot B = mag(A)*mag(B)*cos(theta)<br>(A dot B)/(mag(A)*mag(B)) = cos(theta)<br>cos-1( (A dot B)/(mag(A)*mag(B) ) = theta<br> </div>-B<br></div><br>