3

I am running into the a problem with creating a coverage with GeoServer REST API. Somehow when creating the coverage it does not load the band definitions.

I tried several thing but so far nothing worked. For example: I read somewhere that by creating the coverage store I needed to set it to 'external', so I did. Afterwards I created a new coverage. But still the band definitions where not loaded into Geoserver.

See the example here: going to the link: http://localhost/geoserver/rest/workspaces/LIWO_Primair/coveragestores

<coverageStore>
  <name>geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte</name>
  <description>geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte</description>
  <type>ArcGrid</type>
  <enabled>true</enabled>
  <workspace>
    <name>LIWO_Primair</name>
    <href>http://localhost/geoserver/rest/workspaces/LIWO_Primair.xml</href>
  </workspace>
  <url>file:data/LIWO_Primair/geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte.asc</url>
  <coverages>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" 
  href="http://localhost/geoserver/rest/workspaces/LIWO_Primair/coveragestores/geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte/external/coverages.xml" 
  type="application/xml"/>
  </coverages>
</coverageStore>

I also tried to add other things into the coverage itself to get this error fixed. Too many to sum up right now. This is what the coverage call looks like right now.

using the url: http://localhost/geoserver/rest/workspaces/LIWO_Primair/coveragestores/geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte/coverages?recalculate=nativebbox,latlonbbox

<coverage>
    <name>geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte</name>
    <nativeName>geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte</nativeName>
    <title>geo_schiermonnikoog__jachthaven__tp-1d__waterdiepte</title>
    <nativeCRS>PROJCS[&quot;Amersfoort / RD New&quot;,GEOGCS[&quot;Amersfoort&quot;,DATUM[&quot;Amersfoort&quot;,SPHEROID[&quot;Bessel 1841&quot;, 6377397.155, 299.1528128, AUTHORITY[&quot;EPSG&quot;,&quot;7004&quot;]],TOWGS84[565.2369, 50.0087, 465.658, -0.40685733032239757, -0.3507326765425626, 1.8703473836067959, 4.0812],AUTHORITY[&quot;EPSG&quot;,&quot;6289&quot;]],PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],     UNIT[&quot;degree&quot;, 0.017453292519943295],     AXIS[&quot;Geodetic longitude&quot;, EAST],     AXIS[&quot;Geodetic latitude&quot;, NORTH],     AUTHORITY[&quot;EPSG&quot;,&quot;4289&quot;]],   PROJECTION[&quot;Oblique_Stereographic&quot;, AUTHORITY[&quot;EPSG&quot;,&quot;9809&quot;]],   PARAMETER[&quot;central_meridian&quot;, 5.38763888888889],   PARAMETER[&quot;latitude_of_origin&quot;, 52.15616055555555],   PARAMETER[&quot;scale_factor&quot;, 0.9999079],   PARAMETER[&quot;false_easting&quot;, 155000.0],   PARAMETER[&quot;false_northing&quot;, 463000.0],   UNIT[&quot;m&quot;, 1.0],   AXIS[&quot;Easting&quot;, EAST],   AXIS[&quot;Northing&quot;, NORTH],   AUTHORITY[&quot;EPSG&quot;,&quot;28992&quot;]]</nativeCRS>
    <srs>EPSG:28992</srs>
    <enabled>true</enabled>
    <advertised>true</advertised>
    <nativeFormat>ArcGrid</nativeFormat>
    <supportedFormats>
        <string>ArcGrid</string>
        <string>GeoTIFF</string>
        <string>GIF</string>
        <string>Gtopo30</string>
        <string>ImageMosaic</string>
        <string>JPEG</string>
        <string>PNG</string>
        <string>TIFF</string>
    </supportedFormats>
    <interpolationMethods>
        <string>nearest neighbor</string>
        <string>bilinear</string>
        <string>bicubic</string>
    </interpolationMethods>
    <defaultInterpolationMethod>nearest neighbor</defaultInterpolationMethod>
    <projectionPolicy>FORCE_DECLARED</projectionPolicy>
</coverage>

Is there a way to load the band definitions within the create call? or is there a way to do this outside of the create call?

It would be very helpful to get this working.

edit: The question from RoVo what I mean with band definitions.

enter image description here

  • what do you mean by band definitions? – pLumo Aug 29 '17 at 11:27
  • @RoVo I added a screenshot from GeoServer these are band definitions loaded by hand, this should be done with REST – BonifatiusK Aug 29 '17 at 11:33
  • 1
    can you set one up by hand and then use REST to request the coverage - that will show you what is needed – Ian Turton Aug 29 '17 at 12:23
  • the point is, I can create the store. When I do this by hand the band definitions are loaded automatically. When I use REST they are not loaded automatically. I am using a script which I need to use for many different workspaces and many different coverages. I can't always create one first. Besides that every store could have different definitions. So it really needs to be done automatically – BonifatiusK Aug 29 '17 at 12:34
1

From your comments you may be misunderstanding my suggestion. I proposed that you fetched a coverage via the REST API to see what the format should be (I believe that is how REST works). So I request

http://localhost:8080/geoserver/rest/workspaces/sf/coveragestores/sfdem/coverages/sfdem.xml

and it returns the following xml:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<coverage>
<name>sfdem</name>
<nativeName>sfdem</nativeName>
<namespace>
<name>sf</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://astun-desktop:8080/geoserver/rest/namespaces/sf.xml" type="application/xml"/>
</namespace>
<title>
sfdem is a Tagged Image File Format with Geographic information
</title>
<description>Generated from sfdem</description>
<keywords>
<string>WCS</string>
<string>sfdem</string>
<string>sfdem</string>
</keywords>
<nativeCRS class="projected">
PROJCS["NAD27 / UTM zone 13N", GEOGCS["NAD27", DATUM["North American Datum 1927", SPHEROID["Clarke 1866", 6378206.4, 294.9786982138982, AUTHORITY["EPSG","7008"]], TOWGS84[2.478, 149.752, 197.726, 0.526, -0.498, 0.501, 0.685], AUTHORITY["EPSG","6267"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4267"]], PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]], PARAMETER["central_meridian", -105.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["scale_factor", 0.9996], PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","26713"]]
</nativeCRS>
<srs>EPSG:26713</srs>
<nativeBoundingBox>
<minx>589980.0</minx>
<maxx>609000.0</maxx>
<miny>4913700.0</miny>
<maxy>4928010.0</maxy>
<crs class="projected">EPSG:26713</crs>
</nativeBoundingBox>
<latLonBoundingBox>
<minx>-103.87108701853181</minx>
<maxx>-103.62940739432703</maxx>
<miny>44.370187074132616</miny>
<maxy>44.5016011535299</maxy>
<crs>EPSG:4326</crs>
</latLonBoundingBox>
<enabled>true</enabled>
<metadata>
<entry key="dirName">sfdem_sfdem</entry>
</metadata>
<store class="coverageStore">
<name>sf:sfdem</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://astun-desktop:8080/geoserver/rest/workspaces/sf/coveragestores/sfdem.xml" type="application/xml"/>
</store>
<nativeFormat>GeoTIFF</nativeFormat>
<grid dimension="2">
<range>
<low>0 0</low>
<high>634 477</high>
</range>
<transform>
<scaleX>30.0</scaleX>
<scaleY>-30.0</scaleY>
<shearX>0.0</shearX>
<shearY>0.0</shearY>
<translateX>589995.0</translateX>
<translateY>4927995.0</translateY>
</transform>
<crs>EPSG:26713</crs>
</grid>
<supportedFormats>
<string>ARCGRID</string>
<string>IMAGEMOSAIC</string>
<string>GTOPO30</string>
<string>GEOTIFF</string>
<string>GIF</string>
<string>PNG</string>
<string>JPEG</string>
<string>TIFF</string>
</supportedFormats>
<interpolationMethods>
<string>nearest neighbor</string>
<string>bilinear</string>
<string>bicubic</string>
</interpolationMethods>
<defaultInterpolationMethod>nearest neighbor</defaultInterpolationMethod>
<dimensions>
<coverageDimension>
<name>GRAY_INDEX</name>
<description>
GridSampleDimension[-9.999999933815813E36,-9.999999933815813E36]
</description>
<range>
<min>-9.999999933815813E36</min>
<max>-9.999999933815813E36</max>
</range>
<nullValues>
<double>-9.999999933815813E36</double>
</nullValues>
<dimensionType>
<name>REAL_32BITS</name>
</dimensionType>
</coverageDimension>
</dimensions>
<requestSRS>
<string>EPSG:26713</string>
</requestSRS>
<responseSRS>
<string>EPSG:26713</string>
</responseSRS>
</coverage>

Then when in future you are adding a coverage via the REST API you just need to add a block like:

<dimensions>
<coverageDimension>
<name>GRAY_INDEX</name>
<description>
GridSampleDimension[-9.999999933815813E36,-9.999999933815813E36]
</description>
<range>
<min>-9.999999933815813E36</min>
<max>-9.999999933815813E36</max>
</range>
<nullValues>
<double>-9.999999933815813E36</double>
</nullValues>
<dimensionType>
<name>REAL_32BITS</name>
</dimensionType>
</coverageDimension>
</dimensions>

to your XML (obviously you need to fill in your own name and values) and GeoServer will pick them up when it ingests the file.

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.