<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">The code should be easily adaptable if
you pass the degree of the node (e.g. 2 or if endstanding then 1)
and then you can also merge ways<br>
<br>
Regards,<br>
Peter<br>
<br>
On 04.06.2015 00:14, John Zhao wrote:<br>
</div>
<blockquote
cite="mid:CA+EBg9Rd+Uq5m8oO7zEu6v5571inoSSFEMBGT+3ZmnHb0=nxEw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Peter,
<div><br>
</div>
<div>Thanks for the explanation.</div>
<div>I think the answer is: </div>
<div>there is no merging logic to combine 2 different but
connected OSM ways in GH.</div>
<div>GH only chop the long OSM ways into several edges by the
intersections. </div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature"><b>Best Regards,</b>
<div><b>ZhiQiang ZHAO</b></div>
</div>
</div>
<br>
<div class="gmail_quote">On Wed, Jun 3, 2015 at 2:27 PM, Peter <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:graphhopper@gmx.de" target="_blank">graphhopper@gmx.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi John,<br>
<br>
the problem is as follows:<br>
Assume the osm ways A-B-C (west to east) and D-E-F
(north to south)<br>
<br>
Now if the node B is the same as F or E then we have a
tower node or junction. But if the nodes C and F are
identical then this would be a pillar node (and we
handle it like a tower node). So the import always
assumes case 1 and we are always safe but in some rare
cases we could avoid creating a tower node.<br>
<br>
Regards,<br>
Peter
<div>
<div class="h5"><br>
<br>
On 03.06.2015 23:13, John Zhao wrote:<br>
</div>
</div>
</div>
<div>
<div class="h5">
<blockquote type="cite">
<div dir="ltr">Hi Peter,
<div><br>
</div>
<div>I am more confused.</div>
<div>I think the original question is:</div>
<div>If there are 2 different OSMways in original
OSM data, they and only they are connected.</div>
<div>And all the other tags are the same.</div>
<div>Does Graphhopper will merge them into a
single edge in GH?</div>
<div>Then the graph is a little bit simplified.</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div><b>Best Regards,</b>
<div><b>ZhiQiang ZHAO</b></div>
</div>
</div>
<br>
<div class="gmail_quote">On Wed, Jun 3, 2015 at
2:07 PM, Peter <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:graphhopper@gmx.de"
target="_blank">graphhopper@gmx.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi John,<br>
<br>
good question :)<br>
<br>
Maybe that is the reason that in rare
cases pillar nodes are incorrectly
determined as tower nodes. One could
introduce a new PILLAR_NODE2=0 variable
and try if everything is still working.
But before I would pick a big area and
count the percentage of those incorrectly
determined tower nodes if this is valuable
at all.<br>
<br>
Regards,<br>
Peter
<div>
<div><br>
<br>
<br>
On 03.06.2015 22:16, John Zhao wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Hi Peter,
<div><br>
</div>
<div>That sounds reasonable. But I
am still confused.</div>
<div>I think the logic is under the
below logic. </div>
<div>Based on the logic and commets,
a node is "mark node as tower node
as it occured at least twice
times", not "at least 3 times".</div>
<div>
<p> <span>void</span>
prepareHighwayNode( <span>long</span>
<span>osmId</span> )</p>
<p> {</p>
<p> <span>int</span> <span>tmpIndex</span>
= getNodeMap().get(<span>osmId</span>);</p>
<p> <span>if</span> (<span>tmpIndex</span>
== <span>EMPTY</span>)</p>
<p> {</p>
<p><span> </span>//
osmId is used exactly once</p>
<p> getNodeMap().put(<span>osmId</span>,
<span>PILLAR_NODE</span>);</p>
<p> } <span>else</span> <span>if</span>
(<span>tmpIndex</span> > <span>EMPTY</span>)</p>
<p> {</p>
<p><span> </span>//
mark node as tower node as it
occured at least twice times</p>
<p> getNodeMap().put(<span>osmId</span>,
<span>TOWER_NODE</span>);</p>
<p> } <span>else</span></p>
<p> {</p>
<p><span> </span>//
tmpIndex is already negative
(already tower node)</p>
<p> }</p>
<p> }</p>
</div>
</div>
<div class="gmail_extra"><br
clear="all">
<div>
<div><b>Best Regards,</b>
<div><b>ZhiQiang ZHAO</b></div>
</div>
</div>
<br>
<div class="gmail_quote">On Wed, Jun
3, 2015 at 12:15 PM, Peter <span
dir="ltr"><<a
moz-do-not-send="true"
href="mailto:graphhopper@gmx.de"
target="_blank">graphhopper@gmx.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0
.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF"
text="#000000">
<div>Hi,<br>
<br>
the details are a bit
trickier as we do everything
very memory efficient.<br>
<br>
And if a osm node occurs
twice it is a pillar node,
otherwise it is a tower
node.<br>
<br>
Kind Regards,<br>
Peter
<div>
<div><br>
<br>
On 03.06.2015 21:05,
John Zhao wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">I go
through the logic:
<div>It go through all
osmways, and count
the occurrence of
nodeID.</div>
<div>if nodeID appear
only once, it's a
pillar node.</div>
<div>otherwise, it's a
tower node.</div>
<div><br>
</div>
<div>That's it. Do I
miss something?</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br
clear="all">
<div>
<div><b>Best
Regards,</b>
<div><b>ZhiQiang
ZHAO</b></div>
</div>
</div>
<br>
<div
class="gmail_quote">On
Wed, Jun 3, 2015 at
11:55 AM, Peter <span
dir="ltr"><<a
moz-do-not-send="true"
href="mailto:graphhopper@gmx.de" target="_blank">graphhopper@gmx.de</a>></span>
wrote:<br>
<blockquote
class="gmail_quote"
style="margin:0 0
0
.8ex;border-left:1px
#ccc
solid;padding-left:1ex">
<div
bgcolor="#FFFFFF"
text="#000000">
<div>Hi,<br>
<br>
there is no
separate
merging logic
(although
there was in
0.1 or
something). In
OSMReader it
is decided
when an edge
is created and
e.g. OSM ways
are splitted
if there are
barriers or
junctions on
the way. So it
decides
whether an osm
nodes will be
a tower node
or just a
pillar node<br>
<br>
Regards,<br>
Peter
<div>
<div><br>
<br>
On 03.06.2015
20:35, John
Zhao wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote
type="cite">
<div dir="ltr">Hi
Peter,
<div><br>
</div>
<div>Could you
tell me where
is the merging
logic?</div>
<div>That's
interesting.</div>
</div>
<div
class="gmail_extra"><br
clear="all">
<div>
<div><b>Best
Regards,</b>
<div><b>ZhiQiang
ZHAO</b></div>
</div>
</div>
<br>
<div
class="gmail_quote">On
Wed, Jun 3,
2015 at 12:09
AM, Peter <span
dir="ltr"><<a
moz-do-not-send="true" href="mailto:graphhopper@gmx.de" target="_blank">graphhopper@gmx.de</a>></span>
wrote:<br>
<blockquote
class="gmail_quote"
style="margin:0
0 0
.8ex;border-left:1px
#ccc
solid;padding-left:1ex">
<div
bgcolor="#FFFFFF"
text="#000000">
<div>Hi Jan,<br>
<br>
we do this
kind of
'merging'
logic already
in the import
step when
deciding what
should be
handled as
tower node and
what is a
pillar node.
Otherwise
you'll need as
twice as many
RAM when
copying from
one graph to
the other.<span><br>
<br>
<div><br>
</div>
<div>> Have
you made a
experiment to
count the
number of 2
degree nodes
with the equal
flags and name
in OSM?</div>
</span>
<div><span>>
And then we
can know how
many edges we
can save.<br>
<br>
</span> Yes,
this should be
done before
implementing
it :)<br>
<br>
And as the
merging logic
is currently
not 100%
optimal, there
could be some
minor savings
even when
recognizing
the different
street names,
but I'm unsure
if it is worth
the effort.<br>
<br>
Issues like
#234 or #111
will probably
make more
difference.<br>
</div>
<br>
Kind Regards,<br>
Peter
<div>
<div><br>
<br>
On 02.06.2015
22:35, John
Zhao wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote
type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>AFAIK,
there is no
this kind of
merging logic
here.</div>
<div>Wait the
answer from
Peter.</div>
<div>Probably
you need to
implement it
by your own.</div>
<div>And it's
not easy. </div>
<div>Maybe can
be done before
import?</div>
<div>What you
want, is
actually
convert a
tower node to
a pillar node.</div>
<div><br>
</div>
</div>
<div
class="gmail_extra"><br
clear="all">
<div>
<div><b>Best
Regards,</b>
<div><b>ZhiQiang
ZHAO</b></div>
</div>
</div>
<br>
<div
class="gmail_quote">On
Tue, Jun 2,
2015 at 1:27
PM, Jan Torben
Heuer <span
dir="ltr"><<a
moz-do-not-send="true" href="mailto:jan@komoot.de" target="_blank">jan@komoot.de</a>></span>
wrote:<br>
<blockquote
class="gmail_quote"
style="margin:0
0 0
.8ex;border-left:1px
#ccc
solid;padding-left:1ex">
<div
style="word-wrap:break-word">Hi ZhiQiang
ZHAO,
<div><br>
</div>
<div>Thanks
for your quick
answer.</div>
<div>I have a
custom
FlagEncoder
that imports
only very few
ways and I
don’t need the
names. I
guess, I have
mostly nodes
with a degree
of two.</div>
<span><font
color="#888888">
<div><br>
</div>
<div>Jan</div>
</font></span>
<div>
<div>
<div><br>
<div>
<div>Am
02.06.2015 um
21:53 schrieb
John Zhao <<a
moz-do-not-send="true" href="mailto:johnthu@gmail.com" target="_blank">johnthu@gmail.com</a>>:</div>
<br>
<blockquote
type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>Have you
made a
experiment to
count the
number of 2
degree nodes
with the equal
flags and name
in OSM?</div>
<div>And then
we can know
how many edges
we can save.</div>
<div><br>
</div>
<div>I doubt
this should be
not too much
for OSM.</div>
</div>
<div
class="gmail_extra"><br
clear="all">
<div>
<div><b>Best
Regards,</b>
<div><b>ZhiQiang
ZHAO</b></div>
</div>
</div>
<br>
<div
class="gmail_quote">On
Tue, Jun 2,
2015 at 11:59
AM, Jan Torben
Heuer <span
dir="ltr"><<a
moz-do-not-send="true" href="mailto:jan@komoot.de" target="_blank">jan@komoot.de</a>></span>
wrote:<br>
<blockquote
class="gmail_quote"
style="margin:0
0 0
.8ex;border-left:1px
#ccc
solid;padding-left:1ex">Hi,<br>
<br>
Can
Graphhopper
merge two ways
with equal
flags and name
if there is no
intersection
between them
(no third way
connected)?<br>
<br>
I would like
to create a
very reduces
graph with
only few
edges. What
would be the
easiest way to
achieve it? I
think I would
have to
disable the
nameIndex for
instance.<br>
<br>
Thanks,<br>
<br>
Jan<br>
<br>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</body>
</html>