Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am able to add individual tables to Geoserver using,

curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d '<featureType><name>quadrella_indica</name></featureType>' http://localhost:8080/geoserver/rest/workspaces/opengeo/datastores/species/featuretypes

But I need to loop through the entire list of shp file and so,

for f in *.shp
   do 
   a=${f,,};
   curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d    '<featureType><name>${a%.*}</name></featureType>' http://localhost:8080/geoserver/rest/workspaces/opengeo/datastores/species/featuretypes 
done

Only returns a 400 Bad request error,

* About to connect() to localhost port 8080 (#0)
*   Trying ::1... connected
* Server auth using Basic with user 'admin'
> POST /geoserver/rest/workspaces/opengeo/datastores/species/featuretypes HTTP/1.1
> Authorization: Basic YWRtaW46Z2Vvc2VydmVy
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8080
> Accept: */*
> Content-type: text/xml
> Content-Length: 47
> 
* upload completely sent off: 47out of 47 bytes
< HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Sun, 25 Nov 2012 18:19:31 GMT
< Connection: close
< 
* Closing connection #0
Trying to create new feature type inside the store, but no attributes were specified

The above error is repeated for all the shp files that are being added to geoserver. Any idea what is wrong?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I could not solve why this was not working and so ended up creating a perl command that works just fine.

http://dpaste.com/839047/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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