Hi Natalia,
You may want to try with the "external" method in order to avoid a physical
copy (streaming data into GeoServer folders) of your NetCDF file which
might be big in favor of having that file being accessed as a simple
external reference.

Try with something like below.
Just make sure you don't have previously partially configured
coveragestores with same name or files copied around on your geoserver data
dir.
If so, please remove that coverage store and also consider cleaning up any
auxiliary file associated with your NetCDF if present. if you didn't define
any NETCDF_DATA_DIR, you should see a .my_file_hash hidden folder beside
your netcdf file if you already successfully did some previous
configuration. (something
like .my_file_3eb615ab61e5f2bfac642bffc5b95003e86bc5ff)

This is the REST command you can use:
curl -u admin:geoserver -v -X PUT "
http://localhost:8080/geoserver/rest/workspaces/WP1/coveragestores/CV2/external.netcdf";
-H "Content-type: text/plain" -d "file:///home/local/my_file.nc"

If everything goes well, you will see an output like this:
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
* Server auth using Basic with user 'support'
> PUT /geoserver/rest/workspaces/WP1/coveragestores/CV2/external.netcdf
HTTP/1.1
> Host: localhost:8080
> Authorization: Basic c3VwcG9ydDpkI09SOEBxMU84RTY=
> User-Agent: curl/7.47.0
> Accept: */*
> Content-type: text/plain
> Content-Length: 56
>
* upload completely sent off: 56 out of 56 bytes
< HTTP/1.1 201 Created
< Content-Disposition: inline;filename=f.txt
< Content-Type: application/xml
< Transfer-Encoding: chunked
< Server: Jetty(9.4.12.v20180830)
<
<coverageStore>
  <name>CV2</name>
  <type>NetCDF</type>
  <enabled>true</enabled>
  <workspace>
    <name>WP1</name>
  </workspace>
  <__default>false</__default>
  <url>file:/home/local/my_file.nc</url>
* Connection #0 to host localhost left intact

Please, let us know.
Cheers,
Daniele

On Tue, Dec 3, 2019 at 2:24 PM Natalia Moraga <ntlmor...@gmail.com> wrote:

> hello all,
> I'm trying to upload a netcdf file to geoserver, without success.
> I did the following steps:
> - create the workspace without problem
> - then the PUT request for the file, following the doc
> https://docs.geoserver.org/latest/en/api/#/latest/en/api/1.0.0/coveragestores.yaml
> :
> curl -u admin:geoserver -v -X PUT "
> http://localhost/geoserver/rest/workspaces/WP1/coveragestores/CV1/file.netcdf?filename=%2Fhome%2Flocal%2Ftest1.zip";
> -H  "accept: application/json" -H  "content-type: application/json"
> the file test1.zip, located in /home/local is a zipped netcdf file (zip
> test1.zip myfile.nc) and is readable by all.
> The answer is 500
>
> The logs file contains:
> [org.geoserver.rest.RestException 500 INTERNAL_SERVER_ERROR: Could not
> acquire reader for coverage.]
> 2019-12-03 15:38:02,322 INFO [rest.catalog] - Using existing coverage
> store: CV1
> 2019-12-03 15:38:02,324 WARN [io.netcdf] - unable to connect to the
> specified source
> file:/opt/tomcat/webapps/geoserver/data/data/WP1/CV1/var/tmp/testnm.zip
> org.geotools.data.DataSourceException: unable to connect to the specified
> source
> file:/opt/tomcat/webapps/geoserver/data/data/WP1/CV1/var/tmp/testnm.zip
>
> the file in tomcat dir is empty:
> -rw-r----- 1 tomcat8 tomcat8 0 Dec  3 15:38
> /opt/tomcat/webapps/geoserver/data/data/WP1/CV1/var/tmp/testnm.zip
>
> I am also able to to the same process using the webgui and it works well.
> Only the REST API is a problem.
>
> Anybody can help?
> Thanks in advance
>
> Natalia
>
>
> --
> Natalia Moraga
> Géographe / 07 66 23 87 33
> _______________________________________________
> 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
>


-- 
Regards,
Daniele Romagnoli
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.
_______________________________________________
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