[GIS] pgsql2shp ERROR: incompatible mixed geometry types in table

exportpgsql2shppostgisshapefile

I have multi-linestring in .shp files and I split the lines with postgis, but that result is only geom column.

It does not works with shape file exporter

error: incompatible mixed geometry types in table

I guess it needs at least gid, shape_leng, polyline_n …etc columns?

How can I get data able to export .shp file with only geom column?

Best Answer

Probably in your table there are more than one type of geometry but, in a shape file, you must have only a type (Line, Polygon or Point). When you split lines the result could be not only a line but a point ( or multi). Use st_geometrytype(geom) for analyze what you have in your table. If you only need lines, you have just to delete what is not a linestring:

DELETE FROM tablename WHERE st_geometrytype(geom) NOT IN ('ST_LineString', 'ST_MultiLineString');

After this, export will work. If you want only the geometry column of the shape just delete the .dbf file.

Related Question