Hello Mr. Scarr,
I am faced with the same situation in which I am able to reference a
shape file that is not in the geoserver's data directory. However, in order
to preview the shape file I would have to manually create the layers and
publish it for the file from the add a new resource section under layers
section of the Geoserver's UI. If the files are uploaded into the data
directory the feature types are automatically created. The same applies for
geotiff's that are refernced externally using the external.geotiff?
examples. Since shapefiles in geoserver does not support external.shp (I was
told).
If there is any further information that could help me solve this problem
and applying this patch please could you relay such.
Thank you in advance
Regards,
Mckeane
Vektah wrote:
>
> I am trying to create a new datastore & FeatureType that points to a
> shapefile that already exists on the GeoServer machine using the REST
> API with the assumption that it will pick up the projection and bounds
> form the prj files (works from web interface). I have seen lots of
> examples of people uploading shapefiles, however the datastore is
> already on the host (nfs mounted) so I dont really want to duplicate
> any of the data.
>
> When I create a datastore I am posting to
> /workspaces/acme/datastores(JSON):
> {"dataStore": {"connectionParameters": {"url":
> "file:/var/tropicalhub/hydrology/Daintree/Daintree_Catchments.shp"},
> "enabled": true, "name": "Test"}}
> and this seems to succeed, but it has no FeatureType. At this point I
> tested that I could add one from the web interface and it filled in
> the correct EPSG projection and could calulate the bounds.
>
> So next I tried to create a FeatureType manually for that datastore
> /workspaces/acme/datastores/Test/featuretypes(JSON):
> {"featureType": {"enabled": true, "name": "Test"}}
>
> And the server returns a 500: Internal Server Error
>
> Environment:
> - GeoServer 2.0.1
> - Rest-2.0.1
> - Python 2.6 urllib2 to access REST interface
>
> I've attached a full list of all REST GETS/POSTS and the error from
> catalina.out
>
> Any ideas?
>
> Regards,
> Adam Scarr
>
> [\/] Got: /workspaces
> {u'workspaces': {u'workspace': [{u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/Test.json', u'name':
> u'Test'}, {u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme.json', u'name':
> u'acme'}, {u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/Tropical.json', u'name':
> u'Tropical'}]}}
> [\/] Got: /layers
> {u'layers': {u'layer': [{u'href':
> u'http://127.0.0.1/geoserver/rest/layers/Daintree_Catchments.json',
> u'name': u'Daintree_Catchments'}, {u'href':
> u'http://127.0.0.1/geoserver/rest/layers/Tully_Adjoint.json', u'name':
> u'Tully_Adjoint'}]}}
> [\/] Got: /workspaces/acme
> {u'workspace': {u'dataStores':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme/datastores.json',
> u'name': u'acme', u'coverageStores':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme/coveragestores.json'}}
> [\/] Got: /workspaces/acme/datastores
> {u'dataStores': {u'dataStore': [{u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme/datastores/Test.json',
> u'name': u'Test'}]}}
> ######## Deleting test datastore ########
> [\/] Got: /workspaces/acme/datastores/Test
> {u'dataStore': {u'connectionParameters': {u'entry': {u'@key': u'url',
> u'$':
> u'file:/var/tropicalhub/hydrology/Daintree/Daintree_Catchments.shp'}},
> u'featureTypes':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme/datastores/Test/featuretypes.json',
> u'enabled': True, u'name': u'Test', u'workspace': {u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/WorkspaceInfoImpl--19f8036a:128ebbf79f3:-7ffe.json',
> u'name': u'acme'}}}
> [\/] Got: /workspaces/acme/datastores/Test/featuretypes
> {u'featureTypes': u''}
> [><] Deleting: /workspaces/acme/datastores/Test
> ######## Createing test datastore ########
> [/\] Posting to /workspaces/acme/datastores:
> {"dataStore": {"connectionParameters": {"url":
> "file:/var/tropicalhub/hydrology/Daintree/Daintree_Catchments.shp"},
> "enabled": true, "name": "Test"}}
> ######## Getting new test datastore ########
> [\/] Got: /workspaces/acme/datastores/Test
> {u'dataStore': {u'connectionParameters': {u'entry': {u'@key': u'url',
> u'$':
> u'file:/var/tropicalhub/hydrology/Daintree/Daintree_Catchments.shp'}},
> u'featureTypes':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme/datastores/Test/featuretypes.json',
> u'enabled': True, u'name': u'Test', u'workspace': {u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/WorkspaceInfoImpl--19f8036a:128ebbf79f3:-7ffe.json',
> u'name': u'acme'}}}
> [\/] Got: /workspaces/acme/datastores/Test/featuretypes
> {u'featureTypes': u''}
> ######## New test datastore ########
> {'dataStore': {u'connectionParameters': {u'entry': {u'$':
> u'file:/var/tropicalhub/hydrology/Daintree/Daintree_Catchments.shp',
> u'@key': u'url'}},
> u'enabled': True,
> u'featureTypes':
> u'http://127.0.0.1/geoserver/rest/workspaces/acme/datastores/Test/featuretypes.json',
> u'name': u'Test',
> u'workspace': {u'href':
> u'http://127.0.0.1/geoserver/rest/workspaces/WorkspaceInfoImpl--19f8036a:128ebbf79f3:-7ffe.json',
> u'name': u'acme'}}}
> {}
> ######## adding new featureType ########
> [/\] Posting to /workspaces/acme/datastores/Test/featuretypes:
> {"featureType": {"enabled": true, "name": "Test"}}
> Traceback (most recent call last):
> File "/usr/local/bin/geoadmin", line 35, in <module>
> main()
> File "/usr/local/bin/geoadmin", line 26, in main
> test.features.add(FeatureType(name="Test"))
> File "/home/adam/geoadmin/lib/REST.py", line 58, in add
> return self.srv.post(self.url, object)
> File "/home/adam/geoadmin/lib/REST.py", line 84, in post
> return urlopen(Request(self.baseURL + url, data, {"Content-type" :
> "text/json"})).read()
> File "/usr/local/lib/python2.6/urllib2.py", line 126, in urlopen
> return _opener.open(url, data, timeout)
> File "/usr/local/lib/python2.6/urllib2.py", line 397, in open
> response = meth(req, response)
> File "/usr/local/lib/python2.6/urllib2.py", line 510, in http_response
> 'http', request, response, code, msg, hdrs)
> File "/usr/local/lib/python2.6/urllib2.py", line 435, in error
> return self._call_chain(*args)
> File "/usr/local/lib/python2.6/urllib2.py", line 369, in _call_chain
> result = func(*args)
> File "/usr/local/lib/python2.6/urllib2.py", line 518, in
> http_error_default
> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> urllib2.HTTPError: HTTP Error 500: Internal Server Error
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
--
View this message in context:
http://old.nabble.com/Creating-a-FeatureType-using-REST-tp28763086p29917034.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users