I'm trying to upload a NETCDF file (.nc) to Geoserver Store of Coverage ImageMosaic The command is this:

curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" 
-d "file:///data/coverages/myNetcdf.nc"

as shown in Geoserver 2.4.0 documentation, but I get this message:

* About to connect() to 410.152.23.128 port 8080 (#0)
*   Trying 410.152.23.128...
* Adding handle: conn: 0x94df50
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x94df50) send_pipe: 1, recv_pipe: 0
* Connected to 410.152.23.128 (410.152.23.128:8080) port 8080 (#0)
* Server auth using Basic with user 'admin'
> POST /geoserver/rest/workspaces/mygis/coveragestores/.../external.imagemosaic 
> Authorization: Basic YWRtaW46TYVvc2VydmVy
> User-Agent: curl/7.32.0
> Host: 410.152.23.128:8080
> Accept: */*
> Content-type: text/plain
> Content-Length: 31
* upload completely sent off: 31 out of 31 bytes
< HTTP/1.1 400 Bad Request
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Wed, 25 Sep 2013 15:48:37 GMT
< Connection: close
Failed to locate the input file file:/data/coverages/myNetcdf.nc* Closing connectio
n 0

the file EXISTS instead, do u know how to fix this issue? is there another way to upload NetCDF files in ImageMosaic Stores? Plugin of Geoserver 2.4.0 doesn't select my file thanx in advance


You cannot upload any file with your cURL code. Becasue it sends "Content-type: text/plain" data not a file to the server. GeoServer accepts uploading files in zip (binary) with this "Content-type: application/zip". So you must try this code (change file path, name etc. for your system)

curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" --data-binary @F:\temporary\testnetcdf.zip

Also you can easily upload GeoTIFF, ImageMosaic or another formats. But you must change file extension in the end of the code. For example file.netcdf to file.geotiff

Another important thing is firstly you have to install NetCDF plugin. Otherwise you get Unsupported format error.


I'm not very familiar with GeoServer, but you are specifying port 8080 twice when passing the remote server address to curl. '

From the link you provided, it appears that you only need to specify the port once.

The error message does not indicate a malformed address, but it would not be the first time an error message was vague or incorrect.

I also note that you have a '...' in the remote address. Is this correct?

I would try correcting both of these issues and seeing if the problem is resolved!


Here is 100% working example for Geoserver v2.13.2


# list stores
curl -v -u admin:geoserver http://localhost/geoserver/rest/workspaces/test/coveragestores

# create coverage store
curl -v -u admin:geoserver -XPOST \
    -H "Content-type: application/json" \
    -d '{"coverageStore":{"name":"myCoverageStore","type":"NetCDF","enabled":true,"_default":false,"workspace":{"name":"test"},"url":"file:test\/SSP2_10dollarsboth.nc"}}' \

# update store coverage
curl -v -u admin:geoserver -XPUT \
    -H "Content-Type: application/zip" \
    -H "Accept: application/json" \
    --data-binary @/my-netcdf-file.nc.zip \

Be aware about COARDS NetCDF Conventions and here you can find sample files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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