[pgrouting-users] Routing via different Layers/Levels

Hi All,

Is there a way to conduct nodding for part of a network instead of the whole network in order to restrict routing through specific channels (i.e. 2 layers network where access is restricted via ramps)?

I tried the below 2 codes:

  1. select pgr_nodeNetwork(‘schema.network_table’,50,’id’,‘geom’) FROM schema.network_table where (Layer=‘first_level’);

  2. select pgr_nodeNetwork(‘schema.network_table’ where (Layer=‘first_level’),50,’id’,‘geom’);

The first is entering endless loop processing the data; the second is returning a syntax Error (@WHERE)!

I know that the second sounds clearly wrong code, but I provided the above example trying to brain-storm with all.

If there is no option to do the required while nodding or creating_topology, is it possible to utilize 2 separately_noded networks (instead of the below highlighted one) within the following code?

SELECT seq, id1 as source, id2 as target, cost FROM pgr_kdijkstraCost(

‘SELECT id, source, target, (st_length(geom) * 0.001) as cost FROM schema.network_table_noded’,

(SELECT id FROM schema.p_table WHERE id=1), (SELECT array_agg(id) FROM schema.p_table), false, false

)

Please advise suitable/potential code….

Happy New Year to ALL

Eyad

Hi Eyad,

I'm a little confused as to what you are trying to do. Just to be clear:

pgr_nodeNetwork() is for creating nodes and splitting edges the intersect but do not have a node at the intersection.

NOTE: there has recently been some bugs reported against 2.0 pgr_nodeNetwork() and there might be a pull request. Check the tickets.

pgr_createtopology() is takes a nodded network and assigns the nodes to the edges.

Typically networks that have overpass/underpass that should not be connected, use a zlevel at each end of the segment. So you might represent an over pass like:

                   E(0)
                  /
          ----B(1)-----
         / / \
A(0)---/ B(0) \-----C(0)
              /
             /
            D(0)

A-B-C is a highway overpass
B-B-E is a highway underpass

(n) is the zlevel

So B(0) and B(1) have the same x-y position but they are not connected together.

You can make a fairly simple clone to pgr_createtopology() to take the zlevel*factor as the z value of a point with the x-y values and check for 3D distance between the nodes. This will result in the B(0) and B(1) getting assigned different node ids and the related segments will then not be connected.

I have some old code floating about that does this, but it is a simple change if you wanted to do it yourself.

If this is not what you are asking about, sorry, please give more details on what you are trying to accomplish.

-Steve

On 1/5/2015 3:57 PM, AUS - Eyad wrote:

Hi All,

Is there a way to conduct nodding for part of a network instead of the
whole network in order to restrict routing through specific channels
(i.e. 2 layers network where access is restricted via ramps)?

I tried the below 2 codes:

1)select pgr_nodeNetwork('schema.network_table',50,’id’,'geom') FROM
schema.network_table where (Layer='first_level');

2)select pgr_nodeNetwork('schema.network_table' where
(Layer='first_level'),50,’id’,'geom');

The first is entering endless loop processing the data; the second is
returning a syntax Error (@WHERE)!

I know that the second sounds clearly wrong code, but I provided the
above example trying to brain-storm with all.

If there is no option to do the required while nodding or
creating_topology, is it possible to utilize 2 separately_noded networks
(instead of the below highlighted one) within the following code?

SELECT seq, id1 as source, id2 as target, cost FROM pgr_kdijkstraCost(

     'SELECT id, source, target, (st_length(geom) * 0.001) as cost FROM
*_schema.network_table_noded_*',

     (SELECT id FROM schema.p_table WHERE id=1), (SELECT array_agg(id)
FROM schema.p_table), false, false

   )

Please advise suitable/potential code….

Happy New Year to ALL

Eyad

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

Hi Steve,

You somehow pointed to what I need. The only difference is:

1) my case includes 2 networks overlapping by (x,y) over most of the
sections (one of them shall be completely lifted). Two full networks which
shall connect only where Ramps (with 2 different z-level_edges) are located.
(Nodes/Edges shall not be duplicated because they exist)

2) the case you presented has only one node where there is 2 different (z
coordinates). (This node shall be duplicated).

I would appreciate it if you could send me sample code/link for cloning of
pgr_createTopology to support 3D because unfortunately I'm not a programmer.

Regards,

Eyad

-----Original Message-----
From: pgrouting-users-bounces@lists.osgeo.org
[mailto:pgrouting-users-bounces@lists.osgeo.org] On Behalf Of Stephen
Woodbridge
Sent: Tuesday, January 6, 2015 1:26 AM
To: pgrouting-users@lists.osgeo.org
Subject: Re: [pgrouting-users] Routing via different Layers/Levels

Hi Eyad,

I'm a little confused as to what you are trying to do. Just to be clear:

pgr_nodeNetwork() is for creating nodes and splitting edges the
intersect but do not have a node at the intersection.

NOTE: there has recently been some bugs reported against 2.0
pgr_nodeNetwork() and there might be a pull request. Check the tickets.

pgr_createtopology() is takes a nodded network and assigns the nodes to
the edges.

Typically networks that have overpass/underpass that should not be
connected, use a zlevel at each end of the segment. So you might
represent an over pass like:

                   E(0)
                  /
          ----B(1)-----
         / / \
A(0)---/ B(0) \-----C(0)
              /
             /
            D(0)

A-B-C is a highway overpass
B-B-E is a highway underpass

(n) is the zlevel

So B(0) and B(1) have the same x-y position but they are not connected
together.

You can make a fairly simple clone to pgr_createtopology() to take the
zlevel*factor as the z value of a point with the x-y values and check
for 3D distance between the nodes. This will result in the B(0) and B(1)
getting assigned different node ids and the related segments will then
not be connected.

I have some old code floating about that does this, but it is a simple
change if you wanted to do it yourself.

If this is not what you are asking about, sorry, please give more
details on what you are trying to accomplish.

-Steve

On 1/5/2015 3:57 PM, AUS - Eyad wrote:

Hi All,

Is there a way to conduct nodding for part of a network instead of the
whole network in order to restrict routing through specific channels
(i.e. 2 layers network where access is restricted via ramps)?

I tried the below 2 codes:

1)select pgr_nodeNetwork('schema.network_table',50,'id','geom') FROM
schema.network_table where (Layer='first_level');

2)select pgr_nodeNetwork('schema.network_table' where
(Layer='first_level'),50,'id','geom');

The first is entering endless loop processing the data; the second is
returning a syntax Error (@WHERE)!

I know that the second sounds clearly wrong code, but I provided the
above example trying to brain-storm with all.

If there is no option to do the required while nodding or
creating_topology, is it possible to utilize 2 separately_noded networks
(instead of the below highlighted one) within the following code?

SELECT seq, id1 as source, id2 as target, cost FROM pgr_kdijkstraCost(

     'SELECT id, source, target, (st_length(geom) * 0.001) as cost FROM
*_schema.network_table_noded_*',

     (SELECT id FROM schema.p_table WHERE id=1), (SELECT array_agg(id)
FROM schema.p_table), false, false

   )

Please advise suitable/potential code..

Happy New Year to ALL

Eyad

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8875 - Release Date: 01/05/15

https://github.com/pgRouting/pgrouting/wiki/Create-Topology-With-Z-Levels-at-Intersections

On 1/6/2015 11:48 AM, AUS - Eyad wrote:

Hi Steve,

You somehow pointed to what I need. The only difference is:

1) my case includes 2 networks overlapping by (x,y) over most of the
sections (one of them shall be completely lifted). Two full networks which
shall connect only where Ramps (with 2 different z-level_edges) are located.
(Nodes/Edges shall not be duplicated because they exist)

2) the case you presented has only one node where there is 2 different (z
coordinates). (This node shall be duplicated).

I would appreciate it if you could send me sample code/link for cloning of
pgr_createTopology to support 3D because unfortunately I'm not a programmer.

Regards,

Eyad

-----Original Message-----
From: pgrouting-users-bounces@lists.osgeo.org
[mailto:pgrouting-users-bounces@lists.osgeo.org] On Behalf Of Stephen
Woodbridge
Sent: Tuesday, January 6, 2015 1:26 AM
To: pgrouting-users@lists.osgeo.org
Subject: Re: [pgrouting-users] Routing via different Layers/Levels

Hi Eyad,

I'm a little confused as to what you are trying to do. Just to be clear:

pgr_nodeNetwork() is for creating nodes and splitting edges the
intersect but do not have a node at the intersection.

NOTE: there has recently been some bugs reported against 2.0
pgr_nodeNetwork() and there might be a pull request. Check the tickets.

pgr_createtopology() is takes a nodded network and assigns the nodes to
the edges.

Typically networks that have overpass/underpass that should not be
connected, use a zlevel at each end of the segment. So you might
represent an over pass like:

                    E(0)
                   /
           ----B(1)-----
          / / \
A(0)---/ B(0) \-----C(0)
               /
              /
             D(0)

A-B-C is a highway overpass
B-B-E is a highway underpass

(n) is the zlevel

So B(0) and B(1) have the same x-y position but they are not connected
together.

You can make a fairly simple clone to pgr_createtopology() to take the
zlevel*factor as the z value of a point with the x-y values and check
for 3D distance between the nodes. This will result in the B(0) and B(1)
getting assigned different node ids and the related segments will then
not be connected.

I have some old code floating about that does this, but it is a simple
change if you wanted to do it yourself.

If this is not what you are asking about, sorry, please give more
details on what you are trying to accomplish.

-Steve

On 1/5/2015 3:57 PM, AUS - Eyad wrote:

Hi All,

Is there a way to conduct nodding for part of a network instead of the
whole network in order to restrict routing through specific channels
(i.e. 2 layers network where access is restricted via ramps)?

I tried the below 2 codes:

1)select pgr_nodeNetwork('schema.network_table',50,'id','geom') FROM
schema.network_table where (Layer='first_level');

2)select pgr_nodeNetwork('schema.network_table' where
(Layer='first_level'),50,'id','geom');

The first is entering endless loop processing the data; the second is
returning a syntax Error (@WHERE)!

I know that the second sounds clearly wrong code, but I provided the
above example trying to brain-storm with all.

If there is no option to do the required while nodding or
creating_topology, is it possible to utilize 2 separately_noded networks
(instead of the below highlighted one) within the following code?

SELECT seq, id1 as source, id2 as target, cost FROM pgr_kdijkstraCost(

      'SELECT id, source, target, (st_length(geom) * 0.001) as cost FROM
*_schema.network_table_noded_*',

      (SELECT id FROM schema.p_table WHERE id=1), (SELECT array_agg(id)
FROM schema.p_table), false, false

    )

Please advise suitable/potential code..

Happy New Year to ALL

Eyad

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8875 - Release Date: 01/05/15

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

Thanks Steve...

All,

I've been trying to change the z-level but up to date I couldn't do
unfortunately

There is conflict in the process conceptually, because after nodding, there
is still no vertices/points feature to edit its z-level! Adding geometry
columns won't add z-level coordinates to network feature (only doable to
points feature)

Also 2 detailed question about the code (previous email), as follows:

1) what feature type shall I replace "st"? network/linestring or point? I
used my own network but the message returned (relation "schema.table" does
not exist)
2) what data type shall I pass for 'f_zlev' and 't_zlev'? I don't understand
why it shall be "text" whereas both levels (from - to) shall be
number/integer to be able to change the z-level from certain level/height to
another

Excuse my poor programming skills as that does not help a lot in such case..
if there is on the internet any example about routing via 2 levels, please
advise

Regards,

Eyad

-----Original Message-----
From: pgrouting-users-bounces@lists.osgeo.org
[mailto:pgrouting-users-bounces@lists.osgeo.org] On Behalf Of Stephen
Woodbridge
Sent: Tuesday, January 6, 2015 10:12 PM
To: pgrouting-users@lists.osgeo.org
Subject: Re: [pgrouting-users] Routing via different Layers/Levels

https://github.com/pgRouting/pgrouting/wiki/Create-Topology-With-Z-Levels-at
-Intersections

On 1/6/2015 11:48 AM, AUS - Eyad wrote:

Hi Steve,

You somehow pointed to what I need. The only difference is:

1) my case includes 2 networks overlapping by (x,y) over most of the
sections (one of them shall be completely lifted). Two full networks which
shall connect only where Ramps (with 2 different z-level_edges) are

located.

(Nodes/Edges shall not be duplicated because they exist)

2) the case you presented has only one node where there is 2 different (z
coordinates). (This node shall be duplicated).

I would appreciate it if you could send me sample code/link for cloning of
pgr_createTopology to support 3D because unfortunately I'm not a

programmer.

Regards,

Eyad

-----Original Message-----
From: pgrouting-users-bounces@lists.osgeo.org
[mailto:pgrouting-users-bounces@lists.osgeo.org] On Behalf Of Stephen
Woodbridge
Sent: Tuesday, January 6, 2015 1:26 AM
To: pgrouting-users@lists.osgeo.org
Subject: Re: [pgrouting-users] Routing via different Layers/Levels

Hi Eyad,

I'm a little confused as to what you are trying to do. Just to be clear:

pgr_nodeNetwork() is for creating nodes and splitting edges the
intersect but do not have a node at the intersection.

NOTE: there has recently been some bugs reported against 2.0
pgr_nodeNetwork() and there might be a pull request. Check the tickets.

pgr_createtopology() is takes a nodded network and assigns the nodes to
the edges.

Typically networks that have overpass/underpass that should not be
connected, use a zlevel at each end of the segment. So you might
represent an over pass like:

                    E(0)
                   /
           ----B(1)-----
          / / \
A(0)---/ B(0) \-----C(0)
               /
              /
             D(0)

A-B-C is a highway overpass
B-B-E is a highway underpass

(n) is the zlevel

So B(0) and B(1) have the same x-y position but they are not connected
together.

You can make a fairly simple clone to pgr_createtopology() to take the
zlevel*factor as the z value of a point with the x-y values and check
for 3D distance between the nodes. This will result in the B(0) and B(1)
getting assigned different node ids and the related segments will then
not be connected.

I have some old code floating about that does this, but it is a simple
change if you wanted to do it yourself.

If this is not what you are asking about, sorry, please give more
details on what you are trying to accomplish.

-Steve

On 1/5/2015 3:57 PM, AUS - Eyad wrote:

Hi All,

Is there a way to conduct nodding for part of a network instead of the
whole network in order to restrict routing through specific channels
(i.e. 2 layers network where access is restricted via ramps)?

I tried the below 2 codes:

1)select pgr_nodeNetwork('schema.network_table',50,'id','geom') FROM
schema.network_table where (Layer='first_level');

2)select pgr_nodeNetwork('schema.network_table' where
(Layer='first_level'),50,'id','geom');

The first is entering endless loop processing the data; the second is
returning a syntax Error (@WHERE)!

I know that the second sounds clearly wrong code, but I provided the
above example trying to brain-storm with all.

If there is no option to do the required while nodding or
creating_topology, is it possible to utilize 2 separately_noded networks
(instead of the below highlighted one) within the following code?

SELECT seq, id1 as source, id2 as target, cost FROM pgr_kdijkstraCost(

      'SELECT id, source, target, (st_length(geom) * 0.001) as cost FROM
*_schema.network_table_noded_*',

      (SELECT id FROM schema.p_table WHERE id=1), (SELECT array_agg(id)
FROM schema.p_table), false, false

    )

Please advise suitable/potential code..

Happy New Year to ALL

Eyad

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8875 - Release Date: 01/05/15

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8875 - Release Date: 01/05/15