[GIS] Disappearing Point Features in Geoserver using WMS

cql-filtergeoserverwms

I have a shapefile with roughly 6,500 points worldwide in it that I am trying to serve with Geoserver 2.2.1 using WMS. All has been apparently fine with it until I implemented a filtering feature on my client application which uses leaflet. When I append a CQL_FILTER (attribute filter, not spatial) into the WMS query, I noticed missing features when zoomed out. When I zoomed back in, they would sometimes reappear, but not always. See the image below –

Side by side comparison

At the zoom level on the left, Atlanta is not displayed. When I zoom in, it is. However, sometimes not even the point in Tampa is displayed at the zoom level on the left. If I zoom out 3 more levels, no points at all will be displayed. I'm not sure the issue is the CQL_FILTER param, as with 6,500 points it's hard to notice a few missing points at a global scale, but the particular filter I'm showing here as an example filters down to only 3 features, and when 1 to 3 of them are missing depending on the zoom level it's particularly noticeable.

I can recreate this same behavior in geoserver's own layer preview using the CQL Filter in the advanced map options, so I'm fairly certain it is not my client application.

As for my own steps at debugging this issue, I have tried the default Points style/sld file to rule out my own layer styling. I have turned off all the caching that I am aware of. I double checked that my projections are correct – I created the shapefile in ArcGIS 10 using WGS_1984_Web_Mercator_Auxiliary_Sphere as the projection, and the layer is set to EPSG:3857 in geoserver, which I think is equivalent. I also upgraded from geoserver 2.2 to 2.2.1 and have had the same issue in both. I have also deleted geoserver's spatial index file (.qix) and let it get recreated since I've seen similar issues in Arc with corrupt spatial indexes, but obviously that did not work either.

Here's a snapshot from Geoserver's own layer preview with the CQL Filter on and zoomed into the same area as shown above. The red circle is approximately where I should be seeing another point (Atlanta).

Openlayers Example

I've tried tweaking every other setting I can think of, but am having no luck. I've also looked up and down the geoserver logs and enabled verbose logging, and do not see any errors/exceptions. I also do not see any bad requests in chrome's developer tools.

If I'm missing any critical info, I'll provide what I can, but this is an internal/non-public application.

Best Answer

The "solution" I implemented was to import the shapefiles into a postGIS database using shp2pqsql, which resolved the disappearing point features when using a CQL Filter. I can make the exact same CQL filter request and see all the points at all zoom levels now. I then had to tweak a few automated processes to update the postGIS database instead of shapefiles, but it only took a few hours.

I'm still unsure of the root cause of disappearing point features. I tried different projections and shapefile writers (QGis, ESRI, shapefile.py or pyShape or something) with the same exact result everytime. I'm no expert on geoserver, so I'm hesitant to call it a bug, and it's probably something particular to my setup, but I was able to reproduce on two different instances running on two different computer of geoserver running 2.2 and 2.2.1, both on Windows (One Xp, on Server 2003).

I am not able to post the source shapefiles either, so I guess the root cause will remain a mystery.

Related Question