1

I'm currently working with GeoServer version 2.23.2 and utilizing the Image Mosaic plugin to manage geospatial data. I harvest granules via REST following the steps outlined in the plugin's manual.

Upon issuing the REST command, I observe that the granules are indexed, and they subsequently appear in the PostgreSQL table. However, the issue I encounter is that these granules are not rendered automatically. In order to display them, I have to follow a somewhat convoluted process:

  1. Go to the store and save it again.
  2. Access the already created layer and recalculate its boundaries (which updates only if I re-save the store).
  3. Finally, save the layer.

I suspect that this approach is not the correct way to handle this situation, and I must be overlooking something important.

Can anyone provide insights or guidance on how to make these granules render without having to go through these manual steps? Is there a more efficient and automated way to achieve this within GeoServer 2.23.2 and the Image Mosaic plugin?

4
  • How are you viewing the layer? if you are going through a GeoWebCache then this is the expected behaviour, I think there is a REST API to update the cache on a layer that would be the "correct" way to do it
    – Ian Turton
    Commented Oct 12, 2023 at 7:53
  • @IanTurton No, I don't have GeoWebCache enabled on that layer. I am viewing through Geoserver's layer preview, and through WMS calls as well. Both show the same behavior. Commented Oct 12, 2023 at 8:29
  • are your new granules outside the bounds of the existing layer?
    – Ian Turton
    Commented Oct 12, 2023 at 9:35
  • Yes. So initially it creates a layer, and auto calculates the bounds, the new granules are out of bounds of the initial one. I expected that indexing would calculate the new bounds automatically. Commented Oct 12, 2023 at 9:41

2 Answers 2

1

When adding granules to a structured coverage there are various parameters that you can add to the end of your request that control what is done after the new granules are added - see the manual for full details.

In your case I suspect you want to add ?recalculate=nativebbox,latlonbbox to force the datastore to recalculate both the native bounding box and the lat/long bounding box.

1
  • I am still encountering this issue, even after requesting recalculation in my mosaic granule harvesting request. After searching through the internet, I encountered this article sourceforge.net/p/geoserver/mailman/geoserver-users/thread/… Apparently, I have to do image mosaic reader reset, which I am not sure how to do. So currently working on that. Thank you for your answer. Commented Oct 13, 2023 at 8:13
0

It appears that in order to render the harvested files in GeoServer using the ImageMosaic plugin, you need to recreate the ImageMosaic reader in GeoServer's memory and then proceed with the recalculation. Here's a step-by-step procedure to achieve this:

  1. Harvest new files without the recalculate option.
  2. Recreate the reader in memory. You can use the following commands to achieve this
# Get the request body of the coverage store
coverageGetRequestBody=$(curl -sb -XGET -H "Content-Type: application/json" "$geoserverHost/geoserver/rest/workspaces/$workspace/coveragestores/$mosaicLayerName")

# Update the coverage store with the request body
storeUpdateRequestCode=$(curl -XPUT -H "Content-Type: application/json" -d "$coverageGetRequestBody" -S -s -o /dev/null --write-out "%{http_code}" "$geoserverHost/geoserver/rest/workspaces/$workspace/coveragestores/$mosaicLayerName")
  1. Reharvest one of the files again with the recalculate option mentioned by @IanTurton in the answers.

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.