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.

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Jan 31, 2018 at 14:24

1 Answer 1

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.

answered Jan 31, 2018 at 14:30
3
  • 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? Commented 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 please Commented Jan 31, 2018 at 15:40
  • Ok, you're right Commented Jan 31, 2018 at 15:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.