Saturday 23 May 2015

GeoServer Layer from PostGIS not updating


I created a WMS layer from a PostGIS table with a fraction of total polygons in GeoServer. Everything displayed fine.


Then, I added the rest of the polygons to the table in postgis. For some reason its not updating the layer. I tried restarting geoserver and its still not updating. How do I get geoserver to update the layer?


I use Open layers WMS layer and OpenLayers.Protocol.WFS.fromWMSLayer(polygons) to get polygon data.


-N


UPDATE: I tried to click Compute from data/Compute from bounding box links to get the new MBR. Unfortunately, it did not update, so here's as much info as I can think to provide.



I have a set of polygons scattered around the US. They are from a pair of SHP files in WGS_1984. I started testing the system with a small set of 100 polygons and now that the system works, I wanted to add the the other polygons to the data. I used shp2sql to create a new table in postgis. Then I used a INSERT INTO polygons (SELECT from ...) to add them to the table that geoserver uses. Now there is about 50k polygons in the table.


I tried updating the MBR as answers below suggest. Here are the current settings of the layer in geoserver:


Native SRS: EPSG:4326 Declared SRS: EPSG:900913


When I hit Compute from data for Native bounding box it gives me:


(Min x,Min y, Max x, Max y)


-10Mil, 5Mil, -10mil, 5Mil


and for the Declared:


-95.xxx,40.xxx,-95.xxx,43.xxx


For whatever reason, they are now updating correctly. The MBR should cover most of the US now and not just that little portion in the middle.



Answer




So here is what I did that fixed it, but its not ideal.


For some reason neither the layer nor the data store updated when I would add data. The layer did not see the new polygons I added. The data store did not see new tables when I added them either.


So I had to create a new PostGIS data store and used the same table to create a new layer. That updated the data, but it would be nice to have the option to update the layer without having to create a new one.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...