Andrea,
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.
I have already tried many things before posting to the list and I looked at the
REST API in detail. It is not clear exactly how the description of the
datastore maps to the information to create it. Perhaps you have not looked
either, as existing shape file directories are described as below, but that
leaves much to be desired in understanding how to create. Please see the
comments after.
{
"dataStore":{
"name":"myStore",
"type":"Directory of spatial files (shapefiles)",
"enabled":true,
"workspace":{
"name":"myWs",
"href":"http:\/\/gis.mysite.com\/rest\/workspaces\/myws.json"
},
"connectionParameters":{
"entry":[
{"@key":"memory mapped buffer","$":"false"},
{"@key":"timezone","$":"Europe\/London"},
{"@key":"fstype","$":"shape"},
{"@key":"create spatial index","$":"true"},
{"@key":"charset","$":"ISO-8859-1"},
{"@key":"filetype","$":"shapefile"},
{"@key":"cache and reuse memory
maps","$":"false"},
{"@key":"enable spatial index","$":"true"},
{"@key":"url","$":"file:gisdata\/myData"},
{"@key":"namespace","$":"wheatstone"}
]
},
"_default":false,
"featureTypes":"http:\/\/gis.seaplanner.com\/rest\/workspaces\/myws\/datastores\/mystore\/featuretypes.json"
}
}
For a start, name and workspace are specified in the POST url, so I guess those
are optional?
The href attributes as well, seem unnecessary for a create, so I guess these
should not be needed?
Posting type as "Directory of spatial files (shapefiles)" would also seem a bit
odd, is that really the way?
As far as connection parameters, are they really specified in this convoluted
format? And will it use defaults not set?
Same with “_default” why underscore? And is it Optional, default false?
featureTypes again, this is like the href attributes, seems inappropriate for a
create/post, presumably excluded.
So really, what I am still asking is as before, what should be the right data
structure?
The curl example, only seems to describe creation with name and workspace,
putting the file path in the body:
curl -v -u admin:geoserver -XPUT -H "Content-type: text/plain"
-d "file:///data/shapefiles/"
"http://localhost:8080/geoserver/rest/workspaces/acme/datastores/shapefiles/external.shp?configure=all"
If I want a name, description it is not clear.
Mark
From: [email protected] [mailto:[email protected]] On Behalf Of Andrea
Aime
Sent: 06 June 2014 11:55
To: Mark Paxton
Cc: [email protected]
Subject: Re: [Geoserver-users] Create Directory of Shape files Datastore with
REST API & JSON
On Fri, Jun 6, 2014 at 12:45 PM, Mark Paxton
<[email protected]<mailto:[email protected]>> wrote:
Hello all,
Please could I ask for a little help – I am trying to create a datastore from a
dir of shapefiles already on the server, using JSON via REST API.
I am unsure of the correct data structure to post to the server, as the
documentation is not quite exhaustive in this area.
Whenever something is not documented there is an easy way to discover the data
structure you need:
* go into the user interface, create the objects you need
* go into the rest api, and grab their xml/json representation
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