1

I have a Line Type shapefiles to be imported to postgis database on my postgresql, I'm using the SHP loader, I checked the "Generate simple geometries instead of MULTI Geometries" options so that the data will be routable. But it gives me an error message like this:

Importing with configuration: jalan_tangsel_test1, public, geom, C:\ms4w\apps\coba1\data\test1\jalan_tangsel_test1.shp, mode=c, dump=1, simple=1, geography=0, index=1, shape=1, srid=0 
Shapefile type: Arc
PostGIS type: LINESTRING[2]
We have a Multilinestring with 19 parts, can't use -S switch!
Shapefile import failed.

But if I unchecked the simple geometries options the shp import will be success, please help me

regards

2 Answers 2

3

Because in your shapefile there is a MultiLineString you could open jalan_tangsel_test1.shp in a software like QGIS, for example. Then go to Vector > Geometry Tools > Multipart to singleparts menu and output jalan_tangsel_test1_singleparts.shp.

enter image description here

After that, you should be able to import jalan_tangsel_test1_singleparts.shp with the SHP loader, as you wish.

0
1

I had the same problem time ago, I just ignored that message and everything has worked smooth since then. One thing I noticed, though, is when single and multi lines (ie. geometry) are merged together in one table. In that case you'd need to use:

ALTER TABLE yourtable DROP CONSTRAINT enforce_geotype_geom;
ALTER TABLE yourtable ADD CONSTRAINT enforce_geotype_geom CHECK ((geometrytype(geom) = ANY (ARRAY['MULTILINESTRING'::text, 'LINESTRING'::text])) OR geom IS NULL);
0

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.