As you suggest, I was already checking the source code for this.
From what I can tell, there’s no direct way to create a datasource like this
from the body of a JSON request.
Perhaps I am wrong, but it will take the author of the code to tell us how as
it is quite a convoluted process to understand.
For now the simplest way is make a PUT request as per:
PUT:
http://localhost:8080/rest/workspaces/WORKSPACENAME/datastores/DATASTORENAME/external.shp
In this url, you have 2 parameters:
First:
external: refers to a file external to geoserver on your sever.
url: Get the content from the url specified in the body of the put.
file: directly upload a file in the body of your put.
Second:
shp: Shapefile format
properties: java properties file
h2: h2 database
spatialite: spatialite database
The body of your put will either be a string to the location of your files, e.g.
file://var/lib/gisdata/<file:///\\var\lib\gisdata\> (this refers to a
directory, though you can point to a single shape file)
or
http://data.geoserver.com/shapes.shp
Alternatively if you use the file option, you put your file in the post and
it’s saved on the sever.
Hopefully that will help a few people!
Interestingly, there’s a start at a GeoServer javascript client API in github
based on openlayers:
https://github.com/geoserver/geoserver/tree/master/src/restconfig/src/client/javascript
Checked in by aaime on 18 Jun 2011…
Regards,
Mark
From: [email protected] [mailto:[email protected]] On Behalf Of Andrea
Aime
Sent: 06 June 2014 14:17
Thanks for the reply, you are usually very helpful with my queries to the
geoserver lists, but really that is not a very constructive reply today.
Sorry, it's all the reply I could afford... I don't know what the structure
would be myself, and I suggested the way I would move if I was the one that had
to configure a shapefile of directories store.
If that's not good enough, you have two options:
* look into the code and figure out how things work (that's normally my plan B)
* get someone to do it for you and write better documentation as a result.
Given I have very little experience with the REST api code and I don't know all
the answers you need by heart, I'll let someone
that does (hopefully) follow up
Cheers
Andrea
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Mark Paxton
Web Application Developer
Tel : +44 (0)1243 816606
Mobile :
Email : [email protected]
[MAKING A DIFFERENCE OFFSHORE]<http://www.searoc.com/>
[SeaRoc Group.]<http://www.searoc.com/>
[ISO 9001 Certification]
SeaRoc Group Ltd. is a registered company (06416555) in England & Wales. Our
Registered Office is 45 South Street, Chichester, West Sussex, PO19 1DS.
Disclaimer<http://searoc.com/index/100/Privacy-Policy>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users