[pgrouting-users] assign_vertex_id usage in Workshop

Hello again,

In section 5 of the Workshop the assign_vertex_id function is used on a MULTILINESTRING column:

http://workshop.pgrouting.org/chapters/topology.html#calculate-topology

This function makes use of the st_startpoint function that can only take as input a LINESTRING. I worked around this by creating an extra column in the ways table, but I wonder what can be the usage may be of a network composed by MULTILINESTRING objects. Perhaps it would be better to simply change the data type used in this example.

Regards,

Luís

On Tue, Apr 9, 2013 at 7:28 PM, Luís de Sousa <luis.a.de.sousa@gmail.com>wrote:

Hello again,

In section 5 of the Workshop the assign_vertex_id function is used on a
MULTILINESTRING column:

http://workshop.pgrouting.org/chapters/topology.html#calculate-topology

This function makes use of the st_startpoint function that can only take
as input a LINESTRING. I worked around this by creating an extra column in
the ways table, but I wonder what can be the usage may be of a network
composed by MULTILINESTRING objects. Perhaps it would be better to simply
change the data type used in this example.

Yes, this is another issue that comes with PostGIS 2.0.
You can change "multi" geometries into single geometry like this:

SELECT (ST_Dump(geom)).geom AS geom FROM <table>

or

ALTER TABLE <table> ALTER COLUMN geom
  SET DATA TYPE geometry(Linestring,4326) USING ST_GeometryN(geom, 1);

In general these are all LINESTRINGS, so it's no problem to convert.

With new release of pgRouting this will be fixed.

Daniel

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