Style function is_connected ?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Style function is_connected ?

Chris66
Hi,

would a new style function is_connected() be difficult to implement ?

It should result "no" for example on this way:

<http://www.openstreetmap.org/browse/way/45838172>

Because it is not connected to any other highway.

Benefit: You could make such routing islands non routable.

Greetings
Chris

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Gerd Petermann
Hi,
Chris66 wrote
Hi,

would a new style function is_connected() be difficult to implement ?

It should result "no" for example on this way:

<http://www.openstreetmap.org/browse/way/45838172>

Because it is not connected to any other highway.

Benefit: You could make such routing islands non routable.
I think it is not possible now. A way is passed to the style evaluation system,
and that system says whether it is a road or not.
To answer the question if a road is connected or not you have to know all roads.
So, we would need a second pass of style evaluation.
On the other hand, I doubt that it causes problems when such a way is marked as
a road. A routing algo should not use it to get out of the square.

Gerd
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Thorsten Kukuk
On Mon, Feb 25, GerdP wrote:

> On the other hand, I doubt that it causes problems when such a way is marked
> as
> a road. A routing algo should not use it to get out of the square.

If you are inside the square, all Garmin devices/software tools
will use the nearest available way and then report an routing error.
So, yes, it is a problem ...

  Thorsten

--
Thorsten Kukuk, Project Manager/Release Manager SLES
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Gerd Petermann
Hi Thorsten,

yes, what else should happen? According to the OSM data there is no wait out,
or do I miss something? Would the device search another road which is close?

Besides that, the question is where you want to stop. If two ways are connected to each other, but
not to any other road, should they be routable? Three, four... ? I am not sure if we already have an algo that finds such independent networks, but it's a standard problem in graph theory and it can be solved in
an acceptable run time.

Gerd

Thorsten Kukuk wrote
On Mon, Feb 25, GerdP wrote:

> On the other hand, I doubt that it causes problems when such a way is marked
> as
> a road. A routing algo should not use it to get out of the square.

If you are inside the square, all Garmin devices/software tools
will use the nearest available way and then report an routing error.
So, yes, it is a problem ...

  Thorsten

--
Thorsten Kukuk, Project Manager/Release Manager SLES
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Thorsten Kukuk
On Mon, Feb 25, GerdP wrote:

> Hi Thorsten,
>
> yes, what else should happen?

That was my answer to your
"I doubt that it causes problems when such a way is marked as a road.
 A routing algo should not use it to get out of the square."

I agree with "A routing algo should not use it", but they are using
it and it causes problems.
And yes, such ways should always be connected :(

  Thorsten

> According to the OSM data there is no wait out,
> or do I miss something? Would the device search another road which is close?
>
> Besides that, the question is where you want to stop. If two ways are
> connected to each other, but
> not to any other road, should they be routable? Three, four... ? I am not
> sure if we already have an algo that finds such independent networks, but
> it's a standard problem in graph theory and it can be solved in
> an acceptable run time.
>
> Gerd
>
>
> Thorsten Kukuk wrote
> > On Mon, Feb 25, GerdP wrote:
> >
> >> On the other hand, I doubt that it causes problems when such a way is
> >> marked
> >> as
> >> a road. A routing algo should not use it to get out of the square.
> >
> > If you are inside the square, all Garmin devices/software tools
> > will use the nearest available way and then report an routing error.
> > So, yes, it is a problem ...
> >
> >   Thorsten
> >
> > --
> > Thorsten Kukuk, Project Manager/Release Manager SLES
> > SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
> > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
> > _______________________________________________
> > mkgmap-dev mailing list
>
> > mkgmap-dev@.org
>
> > http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>
>
>
>
>
> --
> View this message in context: http://gis.19327.n5.nabble.com/Style-function-is-connected-tp5750777p5750799.html
> Sent from the Mkgmap Development mailing list archive at Nabble.com.
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
--
Thorsten Kukuk, Project Manager/Release Manager SLES
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Chris66
In reply to this post by Gerd Petermann
Am 25.02.2013 15:38, schrieb GerdP:

> Besides that, the question is where you want to stop. If two ways are
> connected to each other, but
> not to any other road, should they be routable? Three, four... ?

You never can be perfect. For me a simple test would be sufficient.

way.is_connected()
{
  For each node of way{
    if node is member of another highway return "yes"
  }
  return "no"
}

Chris



_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

WanMil
> Am 25.02.2013 15:38, schrieb GerdP:
>
>> Besides that, the question is where you want to stop. If two ways are
>> connected to each other, but
>> not to any other road, should they be routable? Three, four... ?
>
> You never can be perfect. For me a simple test would be sufficient.
>
> way.is_connected()
> {
>    For each node of way{
>      if node is member of another highway return "yes"

This is the problem. At the point where the style functions are
evaluated the information if a node is a member of another road is not
available. This is evaluated later.

>    }
>    return "no"
> }
>
> Chris
>

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Gerd Petermann
In reply to this post by Chris66
Hi Chris,

I looked into this again.
It seems very easy to detect roads that are not connected after all lines were processed
by the style system. This can be done by looking at the highwayCount value for each node
of a way. If none is > 1, the way is not connected. Maybe a bit more code is needed to
detect self-intersecting roads or rings as such in the sample, but performance shoud be
no problem.

I see only one possible solution to implement this in the rule system:
Create a new rule file (e.g.  roads) which is processed in a 2nd pass.
I tried to implement this, but I found no simple solution.
The problem is that the current style system doesn't allow a 2nd pass, which means
we cannot yet pass the result of the 1st pass.
A possible weak solution woud be to use a roads file that
include 'lines', but that seems a bit confusing to me, and maybe will not work at all
regarding continue etc.
Maybe someone else sees a simple solution?

Gerd


Chris66 wrote
Hi,

would a new style function is_connected() be difficult to implement ?

It should result "no" for example on this way:

<http://www.openstreetmap.org/browse/way/45838172>

Because it is not connected to any other highway.

Benefit: You could make such routing islands non routable.

Greetings
Chris

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Gerd Petermann
Hi,

maybe much easier:
let the style add a tag mkgmap:check_if_connected
for roads that should not be routable if not connected.
StyledConverter could evaluate that tag after all roads are known.

Gerd
GerdP wrote
Hi Chris,

I looked into this again.
It seems very easy to detect roads that are not connected after all lines were processed
by the style system. This can be done by looking at the highwayCount value for each node
of a way. If none is > 1, the way is not connected. Maybe a bit more code is needed to
detect self-intersecting roads or rings as such in the sample, but performance shoud be
no problem.

I see only one possible solution to implement this in the rule system:
Create a new rule file (e.g.  roads) which is processed in a 2nd pass.
I tried to implement this, but I found no simple solution.
The problem is that the current style system doesn't allow a 2nd pass, which means
we cannot yet pass the result of the 1st pass.
A possible weak solution woud be to use a roads file that
include 'lines', but that seems a bit confusing to me, and maybe will not work at all
regarding continue etc.
Maybe someone else sees a simple solution?

Gerd


Chris66 wrote
Hi,

would a new style function is_connected() be difficult to implement ?

It should result "no" for example on this way:

<http://www.openstreetmap.org/browse/way/45838172>

Because it is not connected to any other highway.

Benefit: You could make such routing islands non routable.

Greetings
Chris

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Chris66
Am 01.03.2013 12:37, schrieb GerdP:

> maybe much easier:
> let the style add a tag mkgmap:check_if_connected
> for roads that should not be routable if not connected.
> StyledConverter could evaluate that tag after all roads are known.

Hi Gerd,
good to hear.

So I will stop my plans for writting a preprocessor. ;-)

Chris


_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Style function is_connected ?

Gerd Petermann
Hi Chris,

okay, now I just have to find out what it means to make a road "not routable".

@WanMil or Steve: Would it be enough to add it as a MapLine instead of a MapRoad?

Ciao,
Gerd

Chris66 wrote
Am 01.03.2013 12:37, schrieb GerdP:

> maybe much easier:
> let the style add a tag mkgmap:check_if_connected
> for roads that should not be routable if not connected.
> StyledConverter could evaluate that tag after all roads are known.

Hi Gerd,
good to hear.

So I will stop my plans for writting a preprocessor. ;-)

Chris


_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev