Hi Andrea,

I couldn't make it work. It seems like when using external.<format> the
whole request body is taken as a URL:

$ curl -u admin:geoserver -XPUT -H "Content-type: multipart/form-data" -F
"file=/tmp/test.tif"
http://localhost:8080/geoserver/rest/workspaces/files/coveragestores/myraster/external.geotiff
-F coverageName=testingName

Error while storing uploaded file::no protocol:
--------------------------96b1a53245d1e6ac
Content-Disposition: form-data; name="file"

/tmp/test.tif
--------------------------96b1a53245d1e6ac
Content-Disposition: form-data; name="coverageName"

testingName
--------------------------96b1a53245d1e6ac--

Here some relevant lines from the log:
    ...
    at java.net.URL.<init>(URL.java:439)
    at
org.geoserver.rest.util.RESTUtils.handleEXTERNALUpload(RESTUtils.java:264)
    at
org.geoserver.catalog.rest.StoreFileResource.handleFileUpload(StoreFileResource.java:187)

Cheers.

2016-11-13 15:43 GMT+01:00 Andrea Aime <[email protected]>:

> Hi Victor,
> not sure, but from a quick glance in the code, try adding "coverageName"
> as a form parameter in the upload (I believe this means  the upload will
> have to be a form multipart one)
>
> Cheers
> Andrea
>
> On Sun, Nov 13, 2016 at 12:33 PM, Víctor González <
> [email protected]> wrote:
>
>> Hi,
>>
>> Thanks for your responses.
>>
>> @Peter The problem is that the raster files are uploaded by other process
>> to the server and we
>> don't know their metadata beforehand nor we have the possibility to use a
>> GUI manually for each of them.
>>
>> @Andrea Thanks, I should have read the doc more carefully... That's
>> great, with 'external' the metadata gets loaded automatically. The only
>> thing is that the layer name is taken from the file name. Is it possible to
>> specify the name of the resulting layer in the same request?
>>
>> Regards.
>>
>> 2016-11-11 14:18 GMT+01:00 Andrea Aime <[email protected]>:
>>
>>> As far as I know, you have to change the way you're creating the
>>> coverage store,
>>> using the "external" syntax similar to this example configuring a
>>> shapefile that's
>>> already on disk:
>>>
>>> http://docs.geoserver.org/latest/en/user/rest/examples/curl.
>>> html#adding-an-existing-shapefile
>>>
>>> Sorry I don't have an example for raster data handy (if anybody reading
>>> has one, there's
>>> a guide for quick documentation contributions here:
>>> http://docs.geoserver.org/latest/en/docguide/quickfix.html )
>>>
>>> Cheers
>>> Andrea
>>>
>>>
>>> On Fri, Nov 11, 2016 at 1:32 PM, Víctor González <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm loading a new GeoTIFF layer using REST by adding a new
>>>> coveragestore and coverage (requests below). After that, the layer does not
>>>> have information about bands and I have to use the "Reload band
>>>> definitions" option in the web GUI to load them manually (because I don't
>>>> know the raster metadata and I cannot include it in the request).
>>>>
>>>> Why is the band information not loaded automatically? Is it possible to
>>>> load it programmatically without using the web GUI?
>>>>
>>>> I'm using 2.9.1.
>>>>
>>>> $ curl -u admin:geoserver -XPOST http://localhost:8080/geoserve
>>>> r/rest/workspaces/files/coveragestores.json -H "Content-Type:
>>>> application/json" --data '{
>>>>   "coverageStore" : {
>>>>     "name" : "myraster",
>>>>     "type" : "GeoTIFF",
>>>>     "enabled" : true,
>>>>     "workspace" : {
>>>>       "name" : "files"
>>>>     },
>>>>     "url" : "file:test.tif"
>>>>   }
>>>> }'
>>>>
>>>> $ curl -u admin:geoserver -XPOST http://localhost:8080/geoserve
>>>> r/rest/workspaces/files/coveragestores/myraster/coverages.json -H
>>>> "Content-Type: application/json" --data '{
>>>>   "coverage" : {
>>>>     "name" : "myraster",
>>>>     "enabled" : true,
>>>>     "store" : {
>>>>       "name" : "files:myraster"
>>>>     }
>>>>   }
>>>> }'
>>>>
>>>> Best regards.
>>>>
>>>> --
>>>> Víctor González
>>>> http://geomati.co
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Developer Access Program for Intel Xeon Phi Processors
>>>> Access to Intel Xeon Phi processor-based developer platforms.
>>>> With one year of Intel Parallel Studio XE.
>>>> Training and support from Colfax.
>>>> Order your platform today. http://sdm.link/xeonphi
>>>> _______________________________________________
>>>> Geoserver-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>>
>>>>
>>>
>>>
>>> --
>>> ==
>>> GeoServer Professional Services from the experts! Visit
>>> http://goo.gl/it488V for more information.
>>> ==
>>>
>>> Ing. Andrea Aime
>>> @geowolf
>>> Technical Lead
>>>
>>> GeoSolutions S.A.S.
>>> Via di Montramito 3/A
>>> 55054  Massarosa (LU)
>>> phone: +39 0584 962313
>>> fax: +39 0584 1660272
>>> mob: +39  339 8844549
>>>
>>> http://www.geo-solutions.it
>>> http://twitter.com/geosolutions_it
>>>
>>> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>>>
>>> Le informazioni contenute in questo messaggio di posta elettronica e/o
>>> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
>>> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
>>> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
>>> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
>>> darcene notizia via e-mail e di procedere alla distruzione del messaggio
>>> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
>>> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
>>> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
>>> principi dettati dal D.Lgs. 196/2003.
>>>
>>>
>>>
>>> The information in this message and/or attachments, is intended solely
>>> for the attention and use of the named addressee(s) and may be confidential
>>> or proprietary in nature or covered by the provisions of privacy act
>>> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
>>> Code).Any use not in accord with its purpose, any disclosure, reproduction,
>>> copying, distribution, or either dissemination, either whole or partial, is
>>> strictly forbidden except previous formal approval of the named
>>> addressee(s). If you are not the intended recipient, please contact
>>> immediately the sender by telephone, fax or e-mail and delete the
>>> information in this message that has been received in error. The sender
>>> does not give any warranty or accept liability as the content, accuracy or
>>> completeness of sent messages and accepts no responsibility  for changes
>>> made after they were sent or for other risks which arise as a result of
>>> e-mail transmission, viruses, etc.
>>>
>>> -------------------------------------------------------
>>>
>>
>>
>>
>> --
>> Víctor González
>> http://geomati.co
>>
>> ------------------------------------------------------------
>> ------------------
>> Developer Access Program for Intel Xeon Phi Processors
>> Access to Intel Xeon Phi processor-based developer platforms.
>> With one year of Intel Parallel Studio XE.
>> Training and support from Colfax.
>> Order your platform today. http://sdm.link/xeonphi
>> _______________________________________________
>> Geoserver-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
>
> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054  Massarosa (LU)
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39  339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia via e-mail e di procedere alla distruzione del messaggio
> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>
>
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility  for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
> -------------------------------------------------------
>



-- 
Víctor González
http://geomati.co
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to