I am unable to upload this large vector file of 30GB(Multipart polygon in ArcGIS FGDB). ogr2ogr throws the following error

Warning 1: Geometry to be inserted is of type Multi Surface, whereas the layer geometry type is Multi Polygon. Insertion is likely to fail ERROR 1: COPY statement failed. ERROR: Geometry type (MultiSurface) does not match column type (MultiPolygon) CONTEXT: COPY fuzzy_2016, line 17643, column wkb_geometry: "010C000020110F000002000000010A0000000100000001020000001500000

Note: The same dataset works fine in ArcGIS environment.

  • 2
    What is the command you are using? – Hasan Mustafa Oct 24 '17 at 7:31
  • ogr2ogr -f "PostgreSQL" PG:"host=xxx user=xxxxx dbname=xxxx password=xxxx port=5432" "X:\postgresData\Fuzzy_2016.gdb" "fuzzy_2016" Note:i have already uploaded different datasets with the same command. – Shreyes Shiv Oct 25 '17 at 5:06

The first thing to take a look at, is the specific feature being referenced in the error string. Something about it is making PostGIS think it is a MultiSurface feature. I know you have imported these datasets successfully before, so please provide some information about them. What is the source? How were they created?

PostGIS is pretty strict about data types matching up. If you don't specify the target layer type, PostGIS will guess what type to use, basically by assigning the type of the first features that it imports in the layer. If it then runs across a feature that it thinks is a different type, it will throw an error.
I would try specifying the layer type using -nlt as part of your import command.
ogr2ogr -overwrite -f "PostgreSQL" PG:"host=xxx user=xxxxx dbname=xxxx password=xxxx port=5432" "X:\postgresData\Fuzzy_2016.gdb" "fuzzy_2016" -nlt MULTIPOLYGON

Please note that I also added the -overwrite command to your string as this will ensure any existing table matching that name, and thus formatting, is dropped so it doesn't interfere. If you want to append to an existing table, or some such, then do this testing into a temp table, and change the table name to a permanent table once you have the kinks worked out.
Use the New Layer Name command -nln to do this.
ogr2ogr -overwrite -f "PostgreSQL" PG:"host=xxx user=xxxxx dbname=xxxx password=xxxx port=5432" "X:\postgresData\Fuzzy_2016.gdb" "fuzzy_2016" -nln fuzzy_2016_temp -nlt MULTIPOLYGON
If it continues to give you fits, you could write an sql query to filter out this particular feature during the import and see if it is able to process the rest.

| improve this answer | |
  • 1
    ogr2ogr -overwrite -f "PostgreSQL" PG:"host=xxx user=xxxxx dbname=xxxx password=xxxx port=5432" "X:\postgresData\Fuzzy_2016.gdb" "fuzzy_2016" -nlt MULTIPOLYGON worked perfectly, Thank you. – Shreyes Shiv Nov 20 '17 at 5:03
  • Adding -nlt MULTIPOLYGON took care of this issue for me. – Stonetip Mar 14 at 18:56

This happens to me when the data I'm importing contains CURVEPOLYGONs inside of MULTIPOLYGONs. A MULTIPOLYGON isn't allowed to contain a CURVEPOLYGON, but a MULTISURFACE can contain both POLYGONs and CURVEPOLYGONs.

I fix this by specifying -nlt CONVERT_TO_CURVE as an option to ogr2ogr. The result is that it will import the features as MULTISURFACEs. Each of these collections will contain the curved and regular polygons from the original data. Only the container is converted to the curve type; the non-curved polygons inside are not.

I've run into issues in the past with limited support for curved polygons in certain software, but they seem to load fine in recent versions of QGIS.

| 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.