Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a layer in GeoServer which is stored in a PostGIS database. The geometrytype of the layer is GEOMETRY and now the table only contains LINESTRING. But I what to add points and polygons to the table, this is the reason I choose GEOMETRY as the geometrytype. My layer is working fine in the Layer Preview...

But when I do a GetLegendGraphic request I get the following ServiceException: java.lang.IllegalArgumentException: class com.vividsolutions.jts.geom.Geometry is not supported by this method class com.vividsolutions.jts.geom.Geometry is not supported by this method

My SLD is quite simple:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="" xmlns:ogc=""
  xmlns:xlink="" xmlns:xsi=""
     <CssParameter name="stroke">#FFA618</CssParameter>
     <CssParameter name="stroke-width">2</CssParameter>
     <CssParameter name="stroke-dasharray">5 2</CssParameter>

My GetLegendGraphic request is:

I have tried the request on a GeoServer 2.0.1 and a GeoServer 2.0.2 and in both cases I get ServiceException as above mentioned.

What can I do to get the request working?

share|improve this question
up vote 2 down vote accepted

I found out that my geometry column had a not-null constraint in PostGIS. When I removed the not-null constraint I got rid of the GetLegendGraphic request ServiceException.

Another solution to get rid of the GetLegendGraphic request ServiceException was to change the geometrytype in PostGIS from GEOMETRY TO LINESTRING (change the type in the table geometry_columns), but that is not a valid option in my case.

share|improve this answer

You need a filter something like:

      <ogc:Function name="geometryType">

in the rule you would like to style the lines.

See for a fuller discussion of how to handle multiple geometry types in the same table.

share|improve this answer
My filter only selects the lines as the all have the value 'test'. But I have tried using geometryType filter and I still get the same ServiceException. I have another layer where I have points, lines and polygons.This layer are shown fine (all the geometrytypes are drawn) when I style the layer, but the GetLegendGraphic request still fails... – taudorf Oct 6 '10 at 14:23
could be a bug then. – iant Oct 6 '10 at 15:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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