I'm trying to make a postgis table ready for pgrouting. When I run :

SELECT pgr_createTopology('network.VEJM_BR_SL', 0.001, 'geom', 'id');

I get an error:

"Geometry has Z dimension but column does not"

It seems related to the "geom" column being the type "LinestringZ". I believe it means that it is with Z values. I've tried to use ST_Force2D like this:

SELECT pgr_createTopology('network.VEJM_BR_SL', 0.001, ST_Force2D('geom'), 'id'); 

but it does not work. Any suggestions?

3 Answers 3


Unfortunately that parameter needs to be a column name, so you can't apply a function to it since it builds an sql internally. If you don't need your column to have a Z, then I would suggest changing your table.


a) update existing column using

  ALTER COLUMN geom TYPE geometry(LINESTRING,4326) USING ST_Force2D(geom) ;  


b) Add a new 2D column

ALTER TABLE network.VEJM_BR_SL ADD COLUMN geom_2d geometry(LINESTRING,4326);
UPDATE network.VEJM_BR_SL SET geom_2d = ST_Force2D(geom);

I should also add that if your tables are mixed case names, not all lowercase, you should probably change them to lowercase to save yourself some grief down the road of having to always "" quote them.

For the above I assumed your srid is 4326 - change it to whatever yours is currently.

If you go with plan b, then pass in 'geom_2d' for the column name.


SELECT pgr_createTopology('network.VEJM_BR_SL', 0.001, ST_Force2D(geom), 'id');

Try running the query without quotes around geom.

  • thanks for your reply! But then I get an error: "column "geom" does not exist" Commented Mar 16, 2015 at 14:04
  • Well then your geometry column is not called geom. Commented Mar 16, 2015 at 14:40

There is now a function to create a valid node table - pgr_nodeNetwork. This table should be used for routing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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