For reference this API example, with the data path internal to Geoserver 
doesn't work in Ubuntu either.

curl -v -u admin:geoserver -XPUT -H "Content-type: text/plain"
  -d "file:///data/shapefiles/rivers/rivers.shp"
  
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/rivers/external.shp

I ended up using the Importer extension. It sounds like this is the way forward.

I would be happy to assist by amending the documentation if I am able to 
understand how the API should behave.

Cheers.


From: Russell Grew
Sent: Thursday, 30 July 2020 9:29 AM
To: 'geoserver-users@lists.sourceforge.net' 
<geoserver-users@lists.sourceforge.net>
Subject: REST API on Windows not recognising data directory

Hi,

I am running Geoserver 2.17.1 on Windows 10 with OpenJDK 11 and exploring the 
REST API for the first time.

Following 
https://docs.geoserver.org/stable/en/user/rest/stores.html#adding-an-existing-shapefile
 I am trying to add a data store for files already on the server. A 
GEOSERVER_DATA_DIR environment variable is defined, pointing to 
d:\geoserver_data_dir.

This works

curl -v -u admin:geoserver -XPUT -d 
"file:d:\geoserver_data_dir\data\russell\groundwater_divide.shp" 
"http://localhost:8080/geoserver/rest/workspaces/russell/datastores/test/external.shp";

The below, and any variation on it that I can think of (file://<file:///>, 
file:///, backslashes in the path, running in bash) does not work.

curl -v -u admin:geoserver -XPUT -d "file:data/russell/groundwater_divide.shp" 
"http://localhost:8080/geoserver/rest/workspaces/russell/datastores/bar/external.shp";

When I inspect shapefile stores in the UI the locations look like the example 
"file:data/shapefiles/states.shp" or similar.

The Geoserver log shows

2020-07-30 09:04:11,705 ERROR [geoserver.rest] - Failed to locate the input 
file file:data/russell/groundwater_divide.shp
org.geoserver.rest.RestException 400 BAD_REQUEST: Failed to locate the input 
file file:data/russell/groundwater_divide.shp

I attach the curl output and also the logging with geoserver developer details.

Any advice is appreciated. I have the same problem with Tomcat, or the platform 
independent binary.

Thanks,

Russell.
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to