Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
1  
Stopping and Starting the Services can fresh the stores. –  Mapperz Dec 19 '11 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 Dec 19 '11 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? –  iant Dec 20 '11 at 8:43
3  
possible duplicate of GeoServer Layer from PostGIS not updating –  iant Dec 20 '11 at 8:47
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 Dec 20 '11 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 –  pacofvf Dec 20 '11 at 18:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.