Interesting find, thanks.

I still don’t understand why the onus is on the client to know the 
nativeCoverageName in order to make the request work. The nativeCoverageName is 
computed by the Reader from the source file name. Why would a REST client be 
required to know the implementation details of how that name was computed?

In any case, publishing the coverage with a supplied name still does not work 
because of this bug:
https://osgeo-org.atlassian.net/browse/GEOS-7631

Andrea, do you have any insight on these issues?

Thanks,
Scott

From: Bryan Moore [mailto:[email protected]]
Sent: Monday, October 24, 2016 8:40 AM
To: Ellis, Scott (U.S. Person); [email protected]
Subject: Re: [Geoserver-devel] Trouble adding coverage through REST

Scott,

Yes I was able to reproduce it using your example and several other methods, 
same error.

I also found this interesting:


From 2.8.0 documentation:  
http://docs.geoserver.org/2.8.0/user/rest/examples/curl.html
vs
From 2.9.0 documentation:  
http://docs.geoserver.org/2.9.0/user/rest/examples/curl.html


Compare the section: Creating an empty mosaic and harvest granules in each 
version.



2.8.0

Where coverageconfig.xml may look like this

<coverage>

  <name>NO2</name>

</coverage>



2.9.0

Where coverageconfig.xml may look like this

<coverage>

  <nativeCoverageName>NO2</nativeCoverageName>

  <name>NO2</name>

</coverage>






On 10/21/16 8:16 PM, Ellis, Scott wrote:
Thanks a lot for taking a look. Can you reproduce the issue?

The problem is at: org.geoserver.catalog.CatalogBuilder.java:989

cinfo.setNativeCoverageName(coverageName);

Because coverageName is null in this case.

I found I can at least work around the 500 Server Error by changing the REST 
call to the following:

curl -X POST –u admin:geoserver -H "Content-Type: application/json" -d '{
  "coverage": {
    "name": "rest_test_01",
    "nativeCoverageName": "sfdem"
  }
}
' 
"http://myhost:8080/geoserver/rest/workspaces/test/coveragestores/rest_test_01/coverages.json";<http://myhost:8080/geoserver/rest/workspaces/test/coveragestores/rest_test_01/coverages.json>

But this workaround has two problems. A REST client should not need to know the 
correct nativeCoverageName to make  this request work. Also,, GeoServer does 
not honor the supplied name for the new coverage/layer, instead it uses the 
nativeCoverageName, e.g. the new coverage/layer is called 
“test:sfdem<http://engsellis:8080/geoserver/web/wicket/bookmarkable/org.geoserver.web.data.resource.ResourceConfigurationPage?name=sfdem&wsName=test>”
 in this case.

It’s starting to seem like a bug in GeoServer to me but I could be wrong.  Any 
help or insight is very much appreciated.

Thanks,
Scott

From: Bryan Moore [mailto:[email protected]]
Sent: Friday, October 21, 2016 12:04 PM
To: Ellis, Scott (U.S. Person); 
[email protected]<mailto:[email protected]>
Subject: Re: [Geoserver-devel] Trouble adding coverage through REST

Scott,

   Sorry yes.   I got a bit mixed up between your step 1 and step 2.   Let me 
look at it again.

Bryan
On 10/21/16 1:56 PM, Ellis, Scott wrote:
Actually, POST on coverages is supposed to create a new coverage:

From: http://docs.geoserver.org/stable/en/user/rest/api/coverages.html

/workspaces/<ws>/coveragestores/<cs>/coverages[.<format>]
Controls all coverages in a given coverage store and workspace.
Method

Action

Status code

Formats

Default Format

GET

List all coverages in coverage store cs

200

HTML, XML, JSON

HTML

POST

Create a new coverage

201 with Locationheader

XML, JSON



PUT



405





DELETE



405



Once the coverage is created, then you can no longer POST to it, only PUT, 
which is shown in the table you pasted in your response.

The error I am getting trying to POST a new coverage (which should be allowed 
by the API) is:

500 Internal Server Error
“:Resource native name must not be null”

Thanks,
Scott


From: Bryan Moore [mailto:[email protected]]
Sent: Friday, October 21, 2016 11:35 AM
To: 
[email protected]<mailto:[email protected]>
Subject: Re: [Geoserver-devel] Trouble adding coverage through REST

Scott,





However, the second step of adding the coverage, e.g.:



curl -X POST -u admin:geoserver -H "Content-Type: application/json" -d '{

  "coverage": {

    "name": "rest_test_01"

  }

}

' 
"http://myhost:8080/geoserver/rest/workspaces/test/coveragestores/rest_test_01/coverages.json";<http://myhost:8080/geoserver/rest/workspaces/test/coveragestores/rest_test_01/coverages.json%22>;


The problem is that POST on coverages as shown in 
http://docs.geoserver.org/stable/en/user/rest/api/coverages.html returns a 405 
which is "Method not allowed"



GET

Return coveragec

200

HTML, XML, JSON

HTML

quietOnNotFound<http://docs.geoserver.org/stable/en/user/rest/api/coverages.html#rest-api-coverages-quietonnotfound>

POST



405







PUT

Modify coverage c

200

XML,JSON





DELETE

Delete coveragec

200





recurse<http://docs.geoserver.org/stable/en/user/rest/api/coverages.html#rest-api-coverages-recurse>




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to