I want to create an MBTiles datastore using the REST API of GeoServer.
I was able to create a datastore for a shapefile using:
curl -v -u admin:geoserver -XPUT -H "Content-type: text/plain"
-d "file:///data/shapefiles/rivers/rivers.shp"
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/rivers/external.shp
I didn't find any example for MBTiles files. So, I tried the following (after adding the MBTiles extension to my GeoServer):
curl -v -u admin:geoserver -XPUT -H "Content-type: text/plain"
-d "file:///data/path/to/mbtiles/file.mbtiles"
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/rivers/external.mbtiles
But got the following return code:
400 Unsupported format: mbtiles
Can any body help me with the right way or a turn around way.
1 Answer 1
The clue is in the error message - mbtiles is an unsupported format for the rest API.
To fix this you will need to modify the code to support it or request a commercial support provider to do it for you.
-
Thanks Ian for your answer. I can write a code that create the datastore's and layer's XMLs, then put them in the Geoserver's data_dir, but the problem is that Geoserver must be restarted to read these new files, Is there a solution for that?Faz B– Faz B2018年01月31日 15:33:38 +00:00Commented Jan 31, 2018 at 15:33
-
I wouldn't do that - messing with the internals of GeoServer's data directory with out going through the code is prone to causing issues sooner or later. If you have the code roll it into the code base pleaseIan Turton– Ian Turton2018年01月31日 15:40:08 +00:00Commented Jan 31, 2018 at 15:40
-