I've got to make a route with my multilinestring table "routebus", but I can't create the node ids... maybe the fact that it's a multilinestring is the problem, but I really don't know how to solve it. I created "source" and "target" fields and tried with this query:

SELECT assign_vertex_id('routebus', 0.00001, 'the_geom', 'gid');

But it returns me an error:

ERROR: query string argument of EXECUTE is null
État SQL :22004
Contexte : PL/pgSQL function "assign_vertex_id" line 36 at EXECUTE statement

I'm not really used to PostGIS and pgrouting, maybe un must convert multilinestring to linestring?

I have PostGreSQL 9.1.9 with PostGIS 2.0.1 installed

Thanks in advance for your help


With PostGIS 2.0 and higher you can't use ST_StartPoint and ST_EndPoint anymore with Multilinestring geometries.

The assign_vertex_id function uses ST_StartPoint and ST_EndPoint, which means that you either have to to split your Multilinestrings into regular Linestring geometries, or you must use PostGIS 1.5.

But I think it's better you don't use Multilinestring geometries anyway, if you really have some. This may cause troubles with your network. In case you import SHP files with shp2pgsql and you don't specify the geometry type, it usually becomes Multilinestring even if your roads are all regular Linestrings. In that case it's easy to change the geometry type

  • ok, so I did like you said and reimport my shapefile in LINESTRING, and it worked! I didn't know that shapefiles does not differentiate multilinestring and linestring... thanks! Jul 8 '13 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.