[GIS] How to get GeoServer Vector Tile automatically update on data change

geoserverpostgisvector-tiles

I have a spatial table in PostGIS that gets written (Insert/Update/Delete) by a production web app. Almost every minute there's write to the table. The app shows the geometry of the table on web client via database query in the form of 'untiled clear-text-geojson'. The BBOX extent depends on the current client's bbox.

This way of delivering geojson to client now proves to be not efficient as the geojson gets bigger as the points count grow. I would like to try different way. One of them is with Geoserver Vector Tile. I was thinking that with binary data and tile, the required data sent to client potentially becomes smaller.

So I published the table as geoserver layer and activated the 'application/x-protobuf;type=mapbox-vector' under the Tile Caching tab of the layer.

With OpenLayers 5.1.3 I could visualize the geometry from the table, based on this article.

Next I ran a small test with QGIS adding 2 rows (with points geometry) directly to the table. The aim is to get to know whether the points got rendered to the vector tile.

Here's the step (some with corresponding picture):

  1. Open the OL map page in browser. Zoom-in upto zoom level 18, and stop. I intentionally stop zooming down to this zoom level. The map shows the existing points in the table within the map extent.(pict 1)

  2. Add 1 point (point 'A') with QGIS into the PostGIS table.

  3. Panning left and right on the map does not change the VT to show point A.
  4. Zooming-in exactly 1 level upto Zoom level 19, and stop. Again,
    I intentionally stop zooming down to this zoom level. Now point A is shown.enter image description here

  5. Add 1 more point (point 'B') with QGIS into the PostGIS table.

  6. Panning left and right on the map does not change the VT to show point B (similar to step 3).
  7. Zooming-in exactly 1 level upto Zoom level 20, and stop. Now point B and A are shown.(pict 3)
  8. Zooming-out exactly 1 level to Zoom level 19. The tile shows only point A and not B.(pict 4)
  9. Zooming-out exactly 1 level to Zoom level 18. The tile shows none of point A and B!.(pict 5).

  10. Last step: a double check with another browser on another client machine shows exactly similar symptoms:

    • Zoom level 20 shows point A and B
    • Zoom level 19 shows only point A
    • Zoom level 18 shows none of point A & B.

Now to the question:

  1. How to make Geoserver render these added points to the tile that have been generated (and shown) before?

  2. Is the above symptoms are normal with Geoserver Vector Tile?

  3. Is Geoserver Vector Tile appropriate for the above use case (showing points in a table that gets written dynamically)?

Best Answer

GeoServer is receiving no notification about data changes, if you do them directly on the data source, on GeoServer's back.

If you want GeoServer to notice, you can perform the data changes via WFS Transactional, and it will automatically drop the affected tiles for you. As an alternative, you can run reseed or truncate jobs yourself, or create and configure a GeoRSS changes feed.

Related Question