1 (edited by Jim Bacon 04-04-2016 13:03:09)

Topic: Ensuring WMS maps always show small polygons

Hi

I'm just sharing/documenting something I came across this week.

Typically Indicia gathers record locations by Lat/Long (points) or grid squares (polygons). Grid squares can be of varying size and, in the UK, we have used a range from 10m to 10km. When you zoom out to view the whole UK a 10m square is vanishingly small but you might still wish for that to have a representation on the map.

When the map output comes as a WMS from GeoServer the output is styled by a markup language called Styled Layer Descriptor, or SLD (See http://docs.geoserver.org/stable/en/use … ction.html). We have several SLDs on the BRC warehouse with names like dist_point_red and dist_point_green. When displaying a polygon these output first a circle of fixed diameter at the polygon centroid and then overlay the polygon shape itself. When the polygon shape is larger than the circle you can only see the polygon shape. When the polygon shape is smaller than the circle you see the circle with a tiny polygon inside it. (See http://indicia-docs.readthedocs.org/en/ … setup.html).

The problem I found was that, at the zoom level where the polygon shape becomes invisible, GeoServer also gives up drawing the circle and the record becomes invisible. I noticed that if you give GeoServer a point geometry rather than a polygon it will appear as a circle at any zoom level. This suggested a workaround.

I created a view in PostgreSQL with two geometries, the polygon and its centroid as a point. This was used to create a layer in GeoServer to output as a WMS. By pairing this with an SLD that draws a circle from the centroid field and a polygon shape from the full geometry, I was able to ensure that my record was represented at all zoom levels.

Jim Bacon.

2

Re: Ensuring WMS maps always show small polygons

Hi Jim
Both those links give me a 404 error.

Data Manger
Somerset Environmental Records Centre

3

Re: Ensuring WMS maps always show small polygons

Sorry. Caught out again by the automatic linking including punctuation marks after the url. Now fixed.
Jim Bacon.