2

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?

  • You only need an id (or gid if you want to call it that). Just add one to you table. Alter table mytable add column gid serial. This will then display correctly in a GIS once you export back to shp. I assume you are using pgsql2shp? – John Powell Oct 20 '14 at 9:48
  • I use PostGIS shapefile Import/Export Manager (GUI) .. – dionox Oct 22 '14 at 1:32
  • I made id column and tried exporting with using st_multi and pgsql2shp in cmd, but it's useless...TT – dionox Oct 22 '14 at 2:50
  • I flagged to close this because without sample data it's unclear what the problem is and we can never figure it out. – Evan Carroll May 11 '17 at 1:29
3

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.

| improve this answer | |

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.