0

I have already seen this answer

I am running the following:

shp2pgsql -I -s 3401 -t 2D theShapeFile.shp table_name > file_name.sql

And the response I see is:

Shapefile type: PolygonM
Postgis type: MULTIPOLYGONM[2]

My database does not support MULTIPOLYGONM (and I cannot upgrade).

How can I force the output to be MULTIPOLYGON instead of MULTIPOLYGONM ?

  • 1
    I don't think you can directly. Is your data actually MultiPolygonM or is it just declared that way. Because if the latter, you can always do a regex replace or similar on file_name.sql. – John Powell Mar 24 '17 at 19:04
  • 1
    Use ogr2ogr for conversion and cast geometrytype into polygon with -nlt MULTIPOLYGON. – user30184 Mar 24 '17 at 19:25
  • @JohnBarça: I do not really know how to tell if the data is MultiPolygonM or not. But based on your suggestion I just edited file_name.sql and removed the M, and then running that SQL worked. Thank you. If you convert your comment into an answer, I will mark it accepted. – Ask613 Mar 24 '17 at 19:36
0

In the end the solution was to edit the resulting .sql file and remove the letter M so that the type was MULTIPOLYGON. Then I was able to import the .sql file into PostgreSQL.

I do not know if there is any difference in the resulting shapes in PostgreSQL, but non were reported by users.

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.