[pgrouting-users] PgRouting sew-devel-2_0 : topology problem

Hi,

I have built PgRouting from the sew-devel-2_0 branch. I am using
Postgis 2.0 and PostgreSql 9.1.8

I have created a database "routing" and created the postgis and
pgrouting extensions on it :
createdb routing
createlang plpgsql routing
psql -d routing -c "CREATE EXTENSION postgis;"
psql -d routing -c "CREATE EXTENSION pgrouting;"

I did not run the following lines because I assume that "CREATE
EXTENSION pgrouting;" does that but I may be wrong. Anyway, the
/usr/share/postlbs/ directory is empty.
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

Then I run osm2pgrouting, from the georepublic ppa.
osm2pgrouting -file "data.osm" -conf
"/usr/share/osm2pgrouting/mapconfig.xml" -host localhost -dbname
routing -user postgres -clean

osm2pgrouting seems the end coorectly as I got :
size of streets: 41
size of splitted ways : 469
finished

But while the "nodes" table is correctly filled, the "ways" and
"vertices_tmp" tables remain empty. I suspect this might be related to
routing_core.sql, routing_core_wrappers.sql and routing_topology.sql
that I did not run.
Does someone know what I am doing wrong ?

Thanks in advance

--
Frédéric Bonifas
+33672652807 skype:fredericbonifas

On 3/18/2013 10:48 AM, Frédéric Bonifas wrote:

Hi,

I have built PgRouting from the sew-devel-2_0 branch. I am using
Postgis 2.0 and PostgreSql 9.1.8

I have created a database "routing" and created the postgis and
pgrouting extensions on it :
createdb routing
createlang plpgsql routing

You can use "CREATE EXTENSION plpgsql" but I'm not sure it is even needed.

psql -d routing -c "CREATE EXTENSION postgis;"
psql -d routing -c "CREATE EXTENSION pgrouting;"

I did not run the following lines because I assume that "CREATE
EXTENSION pgrouting;" does that but I may be wrong. Anyway, the
/usr/share/postlbs/ directory is empty.
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

Right when you install an extension it loads all the files as part of the extension. And I do not install files in /usr/share/postlbs The extension installs share/postgresql/extension/pgrouting--1.0.7.sql which contains all the SQL concatenated into one file.

One problem with the current setup is that tsp and dd are optional and as a result probably need to be broken out into separate extensions, but that should not be a problem for now.

Then I run osm2pgrouting, from the georepublic ppa.
osm2pgrouting -file "data.osm" -conf
"/usr/share/osm2pgrouting/mapconfig.xml" -host localhost -dbname
routing -user postgres -clean

osm2pgrouting seems the end coorectly as I got :
size of streets: 41
size of splitted ways : 469
finished

But while the "nodes" table is correctly filled, the "ways" and
"vertices_tmp" tables remain empty. I suspect this might be related to
routing_core.sql, routing_core_wrappers.sql and routing_topology.sql
that I did not run.
Does someone know what I am doing wrong ?

A couple of thoughts here:

1. you have to run the topology command assign_vertex_id(), which I have never used as I wrote my own a long time ago.

2. You might (most likely) will need to load legacy.sql from postgis until I have had a chance to review, update and test all the sql code for compatibility with postgis 2.x

Thank you for stepping on on the bleed edge and testing this. I look forward to here about your success and failures. Hopefully more success than failures :slight_smile:

-Steve

Thanks in advance

Thank you for these answers,

* Running legacy.sql did help : the "ways" table is now filled.
psql -d routing -f /usr/share/postgresql/9.1/contrib/postgis-2.0/legacy.sql

* For assign_vertex_id(), I thought that it was already run by
osm2pgrouting as it writes :
[...]
create topology
NOTICE: CREATE TABLE will create implicit sequence
"vertices_tmp_id_seq" for serial column "vertices_tmp.id"
CONTEXT: SQL statement "CREATE TABLE vertices_tmp (id serial)"
PL/pgSQL function "assign_vertex_id" line 15 at EXECUTE statement
#########################
size of streets: 41
size of splitted ways : 469
finished

In the osm2pgrouting source :
https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L372

But the vertices_tmp table remains empty. When running manually SELECT
assign_vertex_id('ways', 0.00001, 'the_geom', 'gid'); I get this :

NOTICE: CREATE TABLE will create implicit sequence
"vertices_tmp_id_seq" for serial column "vertices_tmp.id"
CONTEXT: SQL statement "CREATE TABLE vertices_tmp (id serial)"
PL/pgSQL function "assign_vertex_id" line 15 at EXECUTE statement
ERROR: query string argument of EXECUTE is null
CONTEXT: PL/pgSQL function "assign_vertex_id" line 33 at EXECUTE statement

My "ways" table is in MultiLineString geometry type. Could the problem
come from that ?

Frédéric Bonifas

2013/3/18 Stephen Woodbridge <woodbri@swoodbridge.com>:

On 3/18/2013 10:48 AM, Frédéric Bonifas wrote:

Hi,

I have built PgRouting from the sew-devel-2_0 branch. I am using
Postgis 2.0 and PostgreSql 9.1.8

I have created a database "routing" and created the postgis and
pgrouting extensions on it :
createdb routing
createlang plpgsql routing

You can use "CREATE EXTENSION plpgsql" but I'm not sure it is even needed.

psql -d routing -c "CREATE EXTENSION postgis;"
psql -d routing -c "CREATE EXTENSION pgrouting;"

I did not run the following lines because I assume that "CREATE
EXTENSION pgrouting;" does that but I may be wrong. Anyway, the
/usr/share/postlbs/ directory is empty.
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

Right when you install an extension it loads all the files as part of the
extension. And I do not install files in /usr/share/postlbs The extension
installs share/postgresql/extension/pgrouting--1.0.7.sql which contains all
the SQL concatenated into one file.

One problem with the current setup is that tsp and dd are optional and as a
result probably need to be broken out into separate extensions, but that
should not be a problem for now.

Then I run osm2pgrouting, from the georepublic ppa.
osm2pgrouting -file "data.osm" -conf
"/usr/share/osm2pgrouting/mapconfig.xml" -host localhost -dbname
routing -user postgres -clean

osm2pgrouting seems the end coorectly as I got :
size of streets: 41
size of splitted ways : 469
finished

But while the "nodes" table is correctly filled, the "ways" and
"vertices_tmp" tables remain empty. I suspect this might be related to
routing_core.sql, routing_core_wrappers.sql and routing_topology.sql
that I did not run.
Does someone know what I am doing wrong ?

A couple of thoughts here:

1. you have to run the topology command assign_vertex_id(), which I have
never used as I wrote my own a long time ago.

2. You might (most likely) will need to load legacy.sql from postgis until I
have had a chance to review, update and test all the sql code for
compatibility with postgis 2.x

Thank you for stepping on on the bleed edge and testing this. I look forward
to here about your success and failures. Hopefully more success than
failures :slight_smile:

-Steve

Thanks in advance

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

--
Frédéric Bonifas
+33672652807 skype:fredericbonifas

In the osm2pgrouting source :
https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L372

But the vertices_tmp table remains empty. When running manually SELECT
assign_vertex_id(‘ways’, 0.00001, ‘the_geom’, ‘gid’); I get this :

NOTICE: CREATE TABLE will create implicit sequence
“vertices_tmp_id_seq” for serial column “vertices_tmp.id
CONTEXT: SQL statement “CREATE TABLE vertices_tmp (id serial)”
PL/pgSQL function “assign_vertex_id” line 15 at EXECUTE statement
ERROR: query string argument of EXECUTE is null
CONTEXT: PL/pgSQL function “assign_vertex_id” line 33 at EXECUTE statement

My “ways” table is in MultiLineString geometry type. Could the problem
come from that ?

Yes, osm2pgrouting creates geometries as “MULTILINESTRING” which is not working anymore with functions like “ST_StartPoint” and ST_EndPoint" in PostGIS 2.0.
Legacy.sql doesn’t seem to help here.

I found out that source and target column remain empty therefor. Best would be to change osm2pgrouting and recompile.
In case you use the Ubuntu package and don’t want to compile, you can alter the geometry type to LINESTRING (I don’t think there is any MULTILINESTRING consisting of two lines created) and run assign_vertex_id manually once more.

Daniel

Frédéric Bonifas

2013/3/18 Stephen Woodbridge <woodbri@swoodbridge.com>:

On 3/18/2013 10:48 AM, Frédéric Bonifas wrote:

Hi,

I have built PgRouting from the sew-devel-2_0 branch. I am using
Postgis 2.0 and PostgreSql 9.1.8

I have created a database “routing” and created the postgis and
pgrouting extensions on it :
createdb routing
createlang plpgsql routing

You can use “CREATE EXTENSION plpgsql” but I’m not sure it is even needed.

psql -d routing -c “CREATE EXTENSION postgis;”
psql -d routing -c “CREATE EXTENSION pgrouting;”

I did not run the following lines because I assume that “CREATE
EXTENSION pgrouting;” does that but I may be wrong. Anyway, the
/usr/share/postlbs/ directory is empty.
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

Right when you install an extension it loads all the files as part of the
extension. And I do not install files in /usr/share/postlbs The extension
installs share/postgresql/extension/pgrouting–1.0.7.sql which contains all
the SQL concatenated into one file.

One problem with the current setup is that tsp and dd are optional and as a
result probably need to be broken out into separate extensions, but that
should not be a problem for now.

Then I run osm2pgrouting, from the georepublic ppa.
osm2pgrouting -file “data.osm” -conf
“/usr/share/osm2pgrouting/mapconfig.xml” -host localhost -dbname
routing -user postgres -clean

osm2pgrouting seems the end coorectly as I got :
size of streets: 41
size of splitted ways : 469
finished

But while the “nodes” table is correctly filled, the “ways” and
“vertices_tmp” tables remain empty. I suspect this might be related to
routing_core.sql, routing_core_wrappers.sql and routing_topology.sql
that I did not run.
Does someone know what I am doing wrong ?

A couple of thoughts here:

  1. you have to run the topology command assign_vertex_id(), which I have
    never used as I wrote my own a long time ago.

  2. You might (most likely) will need to load legacy.sql from postgis until I
    have had a chance to review, update and test all the sql code for
    compatibility with postgis 2.x

Thank you for stepping on on the bleed edge and testing this. I look forward
to here about your success and failures. Hopefully more success than
failures :slight_smile:

-Steve

Thanks in advance


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


Frédéric Bonifas
+33672652807 skype:fredericbonifas


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


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de

On Tue, Mar 19, 2013 at 12:04 AM, Stephen Woodbridge <woodbri@swoodbridge.com> wrote:

On 3/18/2013 10:48 AM, Frédéric Bonifas wrote:

Hi,

I have built PgRouting from the sew-devel-2_0 branch. I am using
Postgis 2.0 and PostgreSql 9.1.8

I have created a database “routing” and created the postgis and
pgrouting extensions on it :
createdb routing
createlang plpgsql routing

You can use “CREATE EXTENSION plpgsql” but I’m not sure it is even needed.

psql -d routing -c “CREATE EXTENSION postgis;”
psql -d routing -c “CREATE EXTENSION pgrouting;”

I did not run the following lines because I assume that “CREATE
EXTENSION pgrouting;” does that but I may be wrong. Anyway, the
/usr/share/postlbs/ directory is empty.
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

Right when you install an extension it loads all the files as part of the extension. And I do not install files in /usr/share/postlbs The extension installs share/postgresql/extension/pgrouting–1.0.7.sql which contains all the SQL concatenated into one file.

One problem with the current setup is that tsp and dd are optional and as a result probably need to be broken out into separate extensions, but that should not be a problem for now.

If we still need an own directory in /usr/share I would at least rename it to something like /usr/share/pgrouting :wink:
Otherwise follow the way PostGIS does might be better and use the PostgreSQL shared directory

Personally I would not separate DD and TSP anymore and make it optional.
The CGAL dependency was painful some years ago, but doesn’T PostGIS require CGAL now as well? I might be wrong.
And Gaul dependency for TSP could be probably replaced you said.

If they are not optional anymore, then add ing one pgrouting extension should be enough.

Daniel


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de

I just built osm2pgrouting from the source and it works now. It seems
like the geom type is already LINESTRING there :
https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L84

Thanks again for all the advices

Frédéric Bonifas

2013/3/18 Daniel Kastl <daniel@georepublic.de>:

In the osm2pgrouting source :

https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L372

But the vertices_tmp table remains empty. When running manually SELECT
assign_vertex_id('ways', 0.00001, 'the_geom', 'gid'); I get this :

NOTICE: CREATE TABLE will create implicit sequence
"vertices_tmp_id_seq" for serial column "vertices_tmp.id"
CONTEXT: SQL statement "CREATE TABLE vertices_tmp (id serial)"
PL/pgSQL function "assign_vertex_id" line 15 at EXECUTE statement
ERROR: query string argument of EXECUTE is null
CONTEXT: PL/pgSQL function "assign_vertex_id" line 33 at EXECUTE
statement

My "ways" table is in MultiLineString geometry type. Could the problem
come from that ?

Yes, osm2pgrouting creates geometries as "MULTILINESTRING" which is not
working anymore with functions like "ST_StartPoint" and ST_EndPoint" in
PostGIS 2.0.
Legacy.sql doesn't seem to help here.

I found out that source and target column remain empty therefor. Best would
be to change osm2pgrouting and recompile.
In case you use the Ubuntu package and don't want to compile, you can alter
the geometry type to LINESTRING (I don't think there is any MULTILINESTRING
consisting of two lines created) and run assign_vertex_id manually once
more.

Daniel

Frédéric Bonifas

2013/3/18 Stephen Woodbridge <woodbri@swoodbridge.com>:
> On 3/18/2013 10:48 AM, Frédéric Bonifas wrote:
>>
>> Hi,
>>
>> I have built PgRouting from the sew-devel-2_0 branch. I am using
>> Postgis 2.0 and PostgreSql 9.1.8
>>
>> I have created a database "routing" and created the postgis and
>> pgrouting extensions on it :
>> createdb routing
>> createlang plpgsql routing
>
>
> You can use "CREATE EXTENSION plpgsql" but I'm not sure it is even
> needed.
>
>
>> psql -d routing -c "CREATE EXTENSION postgis;"
>> psql -d routing -c "CREATE EXTENSION pgrouting;"
>>
>> I did not run the following lines because I assume that "CREATE
>> EXTENSION pgrouting;" does that but I may be wrong. Anyway, the
>> /usr/share/postlbs/ directory is empty.
>> psql -d routing -f /usr/share/postlbs/routing_core.sql
>> psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
>> psql -d routing -f /usr/share/postlbs/routing_topology.sql
>
>
> Right when you install an extension it loads all the files as part of
> the
> extension. And I do not install files in /usr/share/postlbs The
> extension
> installs share/postgresql/extension/pgrouting--1.0.7.sql which contains
> all
> the SQL concatenated into one file.
>
> One problem with the current setup is that tsp and dd are optional and
> as a
> result probably need to be broken out into separate extensions, but that
> should not be a problem for now.
>
>
>> Then I run osm2pgrouting, from the georepublic ppa.
>> osm2pgrouting -file "data.osm" -conf
>> "/usr/share/osm2pgrouting/mapconfig.xml" -host localhost -dbname
>> routing -user postgres -clean
>>
>> osm2pgrouting seems the end coorectly as I got :
>> size of streets: 41
>> size of splitted ways : 469
>> finished
>>
>> But while the "nodes" table is correctly filled, the "ways" and
>> "vertices_tmp" tables remain empty. I suspect this might be related to
>> routing_core.sql, routing_core_wrappers.sql and routing_topology.sql
>> that I did not run.
>> Does someone know what I am doing wrong ?
>
>
> A couple of thoughts here:
>
> 1. you have to run the topology command assign_vertex_id(), which I have
> never used as I wrote my own a long time ago.
>
> 2. You might (most likely) will need to load legacy.sql from postgis
> until I
> have had a chance to review, update and test all the sql code for
> compatibility with postgis 2.x
>
>
> Thank you for stepping on on the bleed edge and testing this. I look
> forward
> to here about your success and failures. Hopefully more success than
> failures :slight_smile:
>
> -Steve
>
>> Thanks in advance
>>
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--
Frédéric Bonifas
+33672652807 skype:fredericbonifas
_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--
Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de
_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--
Frédéric Bonifas
+33672652807 skype:fredericbonifas

Oh, then I already changed it there, but didn’t build new packages.

On the user mailing list osm2pgroyting was mention yesterday, too.
And another issue seems to be that OSM data has increased that ID’s had to change to bigint:

alter table relation_ways alter column relation_id type bigint;
alter table relation_ways alter column way_id type bigint;
alter table nodes alter column id type bigint;

Daniel

On Tue, Mar 19, 2013 at 8:10 AM, Frédéric Bonifas <fredericbonifas@gmail.com> wrote:

I just built osm2pgrouting from the source and it works now. It seems
like the geom type is already LINESTRING there :
https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L84

Thanks again for all the advices

Frédéric Bonifas

2013/3/18 Daniel Kastl <daniel@georepublic.de>:

In the osm2pgrouting source :

https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L372

But the vertices_tmp table remains empty. When running manually SELECT
assign_vertex_id(‘ways’, 0.00001, ‘the_geom’, ‘gid’); I get this :

NOTICE: CREATE TABLE will create implicit sequence
“vertices_tmp_id_seq” for serial column “vertices_tmp.id
CONTEXT: SQL statement “CREATE TABLE vertices_tmp (id serial)”
PL/pgSQL function “assign_vertex_id” line 15 at EXECUTE statement
ERROR: query string argument of EXECUTE is null
CONTEXT: PL/pgSQL function “assign_vertex_id” line 33 at EXECUTE
statement

My “ways” table is in MultiLineString geometry type. Could the problem
come from that ?

Yes, osm2pgrouting creates geometries as “MULTILINESTRING” which is not
working anymore with functions like “ST_StartPoint” and ST_EndPoint" in
PostGIS 2.0.
Legacy.sql doesn’t seem to help here.

I found out that source and target column remain empty therefor. Best would
be to change osm2pgrouting and recompile.
In case you use the Ubuntu package and don’t want to compile, you can alter
the geometry type to LINESTRING (I don’t think there is any MULTILINESTRING
consisting of two lines created) and run assign_vertex_id manually once
more.

Daniel

Frédéric Bonifas

2013/3/18 Stephen Woodbridge <woodbri@swoodbridge.com>:

On 3/18/2013 10:48 AM, Frédéric Bonifas wrote:

Hi,

I have built PgRouting from the sew-devel-2_0 branch. I am using
Postgis 2.0 and PostgreSql 9.1.8

I have created a database “routing” and created the postgis and
pgrouting extensions on it :
createdb routing
createlang plpgsql routing

You can use “CREATE EXTENSION plpgsql” but I’m not sure it is even
needed.

psql -d routing -c “CREATE EXTENSION postgis;”
psql -d routing -c “CREATE EXTENSION pgrouting;”

I did not run the following lines because I assume that “CREATE
EXTENSION pgrouting;” does that but I may be wrong. Anyway, the
/usr/share/postlbs/ directory is empty.
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

Right when you install an extension it loads all the files as part of
the
extension. And I do not install files in /usr/share/postlbs The
extension
installs share/postgresql/extension/pgrouting–1.0.7.sql which contains
all
the SQL concatenated into one file.

One problem with the current setup is that tsp and dd are optional and
as a
result probably need to be broken out into separate extensions, but that
should not be a problem for now.

Then I run osm2pgrouting, from the georepublic ppa.
osm2pgrouting -file “data.osm” -conf
“/usr/share/osm2pgrouting/mapconfig.xml” -host localhost -dbname
routing -user postgres -clean

osm2pgrouting seems the end coorectly as I got :
size of streets: 41
size of splitted ways : 469
finished

But while the “nodes” table is correctly filled, the “ways” and
“vertices_tmp” tables remain empty. I suspect this might be related to
routing_core.sql, routing_core_wrappers.sql and routing_topology.sql
that I did not run.
Does someone know what I am doing wrong ?

A couple of thoughts here:

  1. you have to run the topology command assign_vertex_id(), which I have
    never used as I wrote my own a long time ago.

  2. You might (most likely) will need to load legacy.sql from postgis
    until I
    have had a chance to review, update and test all the sql code for
    compatibility with postgis 2.x

Thank you for stepping on on the bleed edge and testing this. I look
forward
to here about your success and failures. Hopefully more success than
failures :slight_smile:

-Steve

Thanks in advance


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


Frédéric Bonifas
+33672652807 skype:fredericbonifas


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


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de


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


Frédéric Bonifas
+33672652807 skype:fredericbonifas


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


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de