1

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

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 Jan 31 '18 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 please – Ian Turton Jan 31 '18 at 15:40
  • Ok, you're right – Faz B Jan 31 '18 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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