Solved this one.
* I haven’t provided data-binary parameter for a local file.
* Misused file-extension, in my case it must be «.tiff» rather than «.tif».
This one worked:
curl -v -u login:pw -XPUT -H "Content-type:image/tiff" --data-binary
@20220701.tiff {host}/geoserver/rest/resource/coverages/test_data/20220701.tiff
>Вторник, 9 августа 2022, 23:54 +02:00 от Ярослав Минин via Geoserver-users
><[email protected]>:
>
>Thank you for your replies.
>Modified my command (using cmd on win10):
>
>E:\rzd\sentinel\tif>curl -v -u login:pw -XPUT -H "Content-type:image/tiff"
>@20220701.tif {host}/geoserver/rest/resource/coverages/test_data/20220701.tif
>
>First thing I get: Could not resolve host: 20220701.tif. File is present in
>the directory I send my command from (E:\rzd\sentinel\tif). Then resource on
>geoserver side is created in target directory with zero length (just a blank
>file).
>
>Is «@20220701.tif» correct a way to call my tif?
>
>>Вторник, 9 августа 2022, 16:48 +02:00 от Erhhung Yuan <
>>[email protected] >:
>>
>>I’m assuming that “/test_data” is a directory? If so, then you’re simply
>>missing the target filename in your curl command:
>>
>>curl -u login:pw -XPUT -H "Content-type:application/zip" @20220701.zip
>>{host}/geoserver/rest/resource/coverages/test_data/ 20220701.zip
>>
>>If the zip is just a single tiff file, then why not just write it with -H
>>“Content-type: image/tiff”?
>>
>>Erhhung
>>
>>From: Jody Garnett < [email protected] >
>>Date: Tuesday, August 9, 2022 at 6:53 AM
>>To: Ярослав Минин < [email protected] >
>>Cc: geoserver-users < [email protected] >
>>Subject: Re: [Geoserver-users] Upload a file from local machine to remote
>>Geoserver data directory
>>EXTERNAL EMAIL : Do not click any links or open any attachments unless you
>>trust the sender and know the content is safe.
>>Install the web-resource extension and you can use a user interface (uses the
>>same rest api as you have below). Uploading a zip should be fine; and the
>>importer extension knows how to unzip.
>>
>>You may also just want to setup a webdav folder for remote management of
>>files and map it to GEOSERVER_DATA_DIR/data
>>
>>There are a couple community extensions that can help; including one that
>>does resumeable upload.
>>
>>If you are just trying to manually manage granules there is a specific rest
>>api for that.
>>--
>>Jody
>>
>>On Tue, Aug 9, 2022 at 3:16 AM Ярослав Минин via Geoserver-users <
>>[email protected] > wrote:
>>>Hello!
>>>
>>>I’m struggling to understand, is there a way to automate file transfer from
>>>a local machine to remote geoserver using curl or anything else (other than
>>>manually copy-paste to server’s file system)?
>>>
>>>The goal is to take a local geotiff (I get new files every day) and transfer
>>>it to the image mosaic directory inside the remote geoserver instance so I
>>>could harvest new granules using curl command.
>>>
>>>I tried to «upload resource» using this command:
>>>
>>>curl -u login:pw -XPUT -H "Content-type:application/zip" @20220701.zip
>>>{host}/geoserver/rest/resource/coverages/test_data
>>>
>>>but it returns 405 informing that I’m attempting to write data to a
>>>directory...well, that’s what I’m trying to achieve but apparently using the
>>>wrong way.
>>>
>>>P.S. I guess packing tif into zip was a mistake but don’t really know what
>>>content-type to use for it.
>>>
>>>--
>>>Sincerely,
>>>Yaras
>>>_______________________________________________
>>>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
>>>
>>>
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>--
>>--
>>Jody Garnett
>
>
>--
>С уважением,
>Ярослав Минин
>
>_______________________________________________
>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
>
>
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
С уважением,
Ярослав Минин
_______________________________________________
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users