gicait / geoserver-rest

Python library for management of geospatial data in GeoServer.
https://geoserver-rest.readthedocs.io
MIT License
195 stars 77 forks source link

Create coverage store for local files #68

Open evansohgit opened 2 years ago

evansohgit commented 2 years ago

Currently, create_coveragestore only works with data upload via put. It should also be possible to use local file as per geoserver UI using "file://path/to/file". I think this would also enable functionality for imagemosaic.

theoway commented 2 years ago

To add imagemosaic, you first have to import the folder to Geoserver, then you can make API call to create imagemosaic datastore. I used importer extension that would upload the folder to geoserver, then make API call to create coverage store. It worked, but it is not recommended to do this way.

evansohgit commented 2 years ago

Thanks for the response, you are right that this is probably not a recommended way to do what is needed.

I am actually trying to port my project to geoserver-rest from gsconfig because that one seems to be no longer supported. Just for your information, it seems a functional implementation can be found in https://github.com/geosolutions-it/gsconfig/blob/8466dbb0f4507c1e21066322c2f3a0e95c0a92fa/src/geoserver/catalog.py#L540.

This caters for whether upload(import) is being used and matches more closely with what can be done via geoserver web interface.

theoway commented 2 years ago

Cool! Wondering if it works for mosaic as well. If it does, it'll be cool. Anyways, the endpoint is same. I'll try to add mosaic option as well to current implementation in geoserver-rest

lstillwe commented 2 years ago

To add imagemosaic, you first have to import the folder to Geoserver, then you can make API call to create imagemosaic datastore. I used importer extension that would upload the folder to geoserver, then make API call to create coverage store. It worked, but it is not recommended to do this way.

Is image mosaic creation for a remote directory of tiff files supported yet? @theoway do you have a code example of how to use the importer to do this? Tried to get it to work, but have not been successful yet. Thanks!

theoway commented 2 years ago

@lstillwe Sorry, I don't have the code for it now. What I can tell you is that this approach was very difficult for me to get working and is not recommended. You can use the COG community plugin, or the image mosaic jdbc plugin. I was working on it long time back and have already started using COG plugin.

lstillwe commented 2 years ago

@theoway @evansohgit Does anyone have just a curl example for creating and image mosaic when the tiffs are already local to the Geoserver file system? I have spent several days trying to get at least that scenario working. Thanks! Here is my latest attempt that still does not work: curl -X POST -u user:passwd -H "Content-Type: application/xml" -d "test-mosaicImageMosaictruefile:mosaics/testing/testmosaic" "http://somehost.org/geoserver/rest/workspaces/test/coveragestores/test-mosaic/coverages.xml"