1

I have data in a PostGIS database that is being pulled into Geoserver using a PostGIS (JNDI) store. The dataset I am using is a continuous polygon grid, but the dataset itself isn't all that large. When I try to have Geoserver's GeoWebCache cache this layer, at a certain zoom level, the layer appears to only be partially complete at the time the GWC "takes a snapshot" of the data. If I zoom in or zoom out one level, the layer tiles appear correct.

The layers are stored as 4326 in PostGIS, but are served as 900913. I have tried converting the table geometry to 900913 so there wouldn't need to be any re-projection, but this has no effect on the cache tiles. I have also tried caching using 4326, but those tiles have the same incomplete layers.

The dataset has a geometry index and the table is clustered on the index.

Is there some kind of optimization I'm not thinking of that would allow GeoWebCache to cache the complete layer instead of the incomplete one?

EDIT: I tried changing the styling to the default "polygon" style, and the layer appears correctly when cached. So it doesn't appear to be an issue with the geometry, it is instead an issue with the styling. I tried making the styling as simple as possible by not needing Geoserver to do any searching for values between X and Y, but instead replacing bins with integers. I also applied an index to the column being used for styling. So all Geoserver really needs to do is style bin_val = 1 blue, bin_val = 2 red, and so forth, but even that isn't returning a complete cached layer.

For example, this is what the cache looks like at zoom level 5: enter image description here

And this is zoom level 4, notice the Alaskan data is only the outermost grid polygons, while the more inshore ones are not visible: enter image description here

Geoserver version 2.4.5

2

1 Answer 1

1

I was able to fix the problem, and here's what was happening:

It turns out there was nothing wrong to begin with, the layer was displaying exactly as I set it, and that was the problem. Because the layer above had such closely-packed grid polygons, I set the style to not draw any borders, otherwise when zoomed out you would just see a slew of black borders, which isn't helpful for what the layer is trying to display. This should work in theory seeing that the borders should be invisible and allow the other nearby rectangles to display. In practice, however, the borders ended up covering the other grid polygons making them to appear like they hadn't rendered whatsoever. So the second image above shows the blue rectangles on the edges because there aren't other grid polygons there to overlap them. All the interior blue polygons are being overlapped by "invisible" borders, which appear to keep them from rendering.

What I ended up doing was setting the border color to be the same as the fill color, which is now allowing the layer to render and cache correctly.

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.