I'm trying to render a layer wich contains some polygons and some multipolygons in geoserver. While polygons are rendered correctly, multipolygon are not.

Geoserver renderer connects the last point of every polygon with the first of the next one:

enter image description here

I checked the shapefile with QGIS and the imported polygons in my DB (Oracle) with Oracle Map Builder and both are rendered correctly:

enter image description here

Am I missing some configurtion in Geoserver to prevent this? Or should I edit the shapefile and separate the multypoligons in multiple single polygons?

  • I would check that the polygon in question is valid - also are you displaying them from Oracle or the shapefile?
    – Ian Turton
    Dec 2, 2021 at 14:27

2 Answers 2


This behavior normally indicates that while the data is MultiPolygon, it has been declared to GeoServer as "Polygon" instead. And it gets turned into one.

Since you are working in Oracle, the geometry type normally comes from metadata on the spatial index, I advice to check there. If that is missing or cannot be fixed, maybe try to use the geometry metadata table instead.

  • Didn't know was the spatial index that drove the type in geoserver. So having both polygons and multipolygons geoserver will automatically select the first type he find. I will try to force the type as multipolygon in the view definition. Thank you!! Dec 6, 2021 at 8:46

Instead of adding layer as table, I will advice to add layer as SQL view. In that way you can change geometry to multipolygon or to polygon, to make it clear for geoserver which type of geometry is. Another option in SQL view is also possibly to set geometry type for geoserver to render.

  • I will try that for sure. I'm not sure if the data are all multipolygons or both polygons and multipolygons, I checked only the problematic ones. Can I set multipolygon as type even if there are different spatial type in my DB? Dec 6, 2021 at 8:50
  • Yep you can, definetly the solution! Thank you! Dec 6, 2021 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.