I've build a table with multiple geometries in PostGIS. This table is published in GeoServer. Now I'm wondering how GeoServer handles this type of layer. specifically the drawing part.

My layer contains all three geometries, points, lines and polygons. In the ideal situation polygons are drawn first, lines second and point third. To prevent polygons overlapping the other geometry types.

The generated WMS looks rather good, all point and lines are visible. My question is: 'Does Geoserver draw objects according to its geometry, in a specific order?'

  • You mention "The generated WMS looks rather good", are you using a certain sld for this currently?
    – artwork21
    May 17, 2017 at 12:04
  • Using CSS to style the layer. May 17, 2017 at 12:04
  • AFAIK the drawing order is handled by the (SLD) style sheet, either within the markup itself or by the order in which you applied them to your layer(s) (geometries)
    – geozelot
    May 17, 2017 at 12:06
  • I always thought the drawing order was defined by the order in the postgis table. Last record is last drawn. Don't know if this is true.. May 17, 2017 at 12:09
  • don't know how its handled internally in detail, but CSS is sequential, too, so I guess you have defined the polygon style first?
    – geozelot
    May 17, 2017 at 12:12

1 Answer 1


GeoServer draws things as defined by their rule order and then in feature order with each symbolizer (roughly the order they are in the table in your case).

The tricky thing is that when dealing with mixed geometries SLD will do funny things (and CSS and YSLD are just SLD in the end). Basically if you have the symbolizer you have specified will be applied to all of the geometries and they will be coerced in to the expected geometry type. So, for example, a point symbolizer will use the centroid of a line or polygon, while a polygon symbolizer will connect the ends of a linestring to make a polygon.

The best (and easiest plan) is to separate features out by geometry type into different tables. The next easiest plan is to use a geometryType filter to determine which symbolizer to apply.

While your map may currently look good what happens if the next feature you add is a large polygon the covers everything else.

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.