5

How do I make geoserver update layers and stores? I've updated the tables in PostGIS used by a data store and layer, but I cannot seem to get it to update. I have the new data running, but I had to create a new Store and Layer just to get it to work. Is there an easier way to refresh stores and/or layers?

Thanks

4
  • 1
    Stopping and Starting the Services can fresh the stores.
    – Mapperz
    Commented Dec 19, 2011 at 20:36
  • Hmm, I've used the shutdown and startup scripts multiple times before creating new stores/layers. Are there services that are not restarted by these scripts?
    – Nate
    Commented Dec 19, 2011 at 21:49
  • 1
    when you say that the tables are updated what do you mean? Does GeoServer not see the new data or just not recognize the new bounds or something else?
    – Ian Turton
    Commented Dec 20, 2011 at 8:43
  • 3
    possible duplicate of GeoServer Layer from PostGIS not updating
    – Ian Turton
    Commented Dec 20, 2011 at 8:47

1 Answer 1

2

The easiest way to achieve that is erasing the geoserver cache manually. You can find the cache location at the file geoserver-directory/WEB-INF/web.xml, there is a variable called GEOSERVER_DATA_DIR, if its not present you can add it and specify the location of the cache directory (mine is /geosrverdata):

<context-param>
   <param-name>GEOSERVER_DATA_DIR</param-name>
    <param-value>/geoserverdata</param-value>
</context-param> 

Then restart tomcat. Inside of this directory you will find this:

/geoserverdata# ls
global.xml  gwc  security  styles  wcs.xml  wfs.xml  wms.xml  workspaces

inside of gwc you will find a directory for each layer, erase the content of each directory but don't delete the directory itself.

You could automate this work with a cron job, and you could erase the cache every two days or every month or even every 15 minutes.

But remeber that the clients(google maps, open layers, etc) could still using old data, so also make sure to erase the cache at the clients.

2
  • Interesting, I looked in the web.xml file and the GEOSERVER_DATA_DIR is commented out. Does that mean its not caching? I did a locate gwc/ and found its located in geoserver/data_dir but I did not see a directory for my layers in the gwc. It contains two directories: diskquota_page_store and meta_jdbc_h2. Is it safe to uncomment that section in the xml and point it to geoserver/data_dir? Or should I create a new directory?
    – Nate
    Commented Dec 20, 2011 at 18:06
  • No it means that it was using the default directory. Sorry I forgot that you have to reconfigure the layer on the geoserver panel. And yes you should use another directory Commented Dec 20, 2011 at 18:22

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.