Hi all,
Recently I have been working on some improvements to restconfig that I would like to run by everyone. The changes have to do with the operations that allow the uploading of a shapefile.
Currently you only really have one option. You upload a shapefile (or reference it externally) and a datastore (and feature type) gets created for that shapefile. Cool, but I think it would be cool to have some flexibility here. Mainly to be able to specify a different datastore than shapefile. For instance maybe you want that shapefile to be stored in an existing postgis database. Or maybe you want a different type of datastore to be automatically created (thinking H2 here mostly).
So currently the api looks mostly like this:
PUT [zipped shapefile] /rest/workspaces//datastores//file.shp
Well nothing really has to change. If you want to use an existing data store you just put to that datastore. For instance:
PUT [zipped shapefile] /rest/workspaces//datastores/foo_pg/file.shp
Would under the covers take the shapefile and create a feature type / table for it (via DataStore.createSchema()). Then copy the contents of the shapefile into that new type.
I was also thinking of doing things like this:
PUT [zipped shapefile] /rest/workspaces//datastores/foo_h2/file.shp?target=h2
In this case the datastore does not exist, but the user specified the type of datastore they want to create via the “target” parameter. In this an H2 database and datastore would be created automatically, and the new type added to it. Now obviously this could not be supported for all types of datastores. For instance we can’t really magically create a new postgis datastore. But for many like h2, and other file based datastores it should be possible.
So… what do you all think? The existing behaviour would be completely maintained. These would really just be additions.
-Justin
–
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.