0

I imported the table from a multipolygon shapefile using PostGIS Shapefile and DBF Loader 2.2. I tried to use the 'generate simple geomtries ...' option in the tool, but got back an error : 'We have a Multipolygon with 3 parts, can't use -S switch! Shapefile import failed.', so I imported the shapefile as a multipolygon.

It seemed to import ok, and a preview of the table look ok as well. But when I try to create a published layer in Geoserver from this table, nothing renders in my Javascript app, and a preview of the layer shows that the multipolygons are missing.

What can I do here?

below is the schema from the PostGIS table: enter image description here

  • please add the table schema – Ian Turton Oct 29 '16 at 9:41
  • @iant image added – JasonBK Oct 31 '16 at 14:00
  • @iant your answer does not address my problem, see the original question and comments – JasonBK Oct 31 '16 at 15:18
1

It looks like you have only imported the multipolygons and not the polygons, hence not a lot shows up when you view it.

I would use ogr2ogr with the -nlt option

-nlt type: Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. And CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE and MULTISURFACE for GDAL 2.0 non-linear geometry types. Add "Z", "M", or "ZM" to the name to get coordinates with elevation, measure, or elevation and measure. Starting with GDAL 1.10, PROMOTE_TO_MULTI can be used to automatically promote layers that mix polygon or multipolygons to multipolygons, and layers that mix linestrings or multilinestrings to multilinestrings. Can be useful when converting shapefiles to PostGIS and other target drivers that implement strict checks for geometry types. Starting with GDAL 2.0, CONVERT_TO_LINEAR can be used to to convert non-linear geometries types into linear geometries by approximating them, and CONVERT_TO_CURVE to promote a non-linear type to its generalized curve type (POLYGON to CURVEPOLYGON, MULTIPOLYGON to MULTISURFACE, LINESTRING to COMPOUNDCURVE, MULTILINESTRING to MULTICURVE). Starting with 2.1 the type can be defined as measured ("25D" remains as an alias for single "Z").

  • the preview from Geoserver shows the opposite of this, the published layer fails at the first feature with mulitple polygons. – JasonBK Oct 31 '16 at 14:36
  • The preview of the PostGIS table as a shapefile is fine. All of the polygons are correctly rendered, both single and multi. – JasonBK Oct 31 '16 at 14:43

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.