Hi Victor,

usually, with REST, it works like this:

If you want to update some property X of some resource Y, first try to configure similar resource via web UI and then make a GET request via REST so that you can see the full configuration with all the options and their values.

In your case, try to make a GET request against this url:

http://localhost:8080/geoserver/rest/workspaces/files/coveragestores/myraster/coverages/myraster.json

You should get something like the attached JSON. Look especially at "dimensions" and "coverageDimension" properties. In general that's how you should format your POST request.

Cheers,

Peter


On 11. 11. 2016 13:32, Víctor González 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/geoserver/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/geoserver/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
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Peter Kovac
IMS Programmer
MicroStep-MIS
peter.ko...@microstep-mis.com

{
   "coverage":{
      "name":"myraster",
      "nativeName":"myraster",
      "namespace":{
         "name":"files",
         
"href":"http:\/\/localhost:8080\/geoserver\/rest\/namespaces\/files.json"
      },
      "title":"My Raster",
      "description":"Generated from GeoTIFF",
      "keywords":{
         "string":[
            "WCS",
            "GeoTIFF"
         ]
      },
      "nativeCRS":{
         "@class":"projected",
         "$":"PROJCS[\"WGS 84 \/ Pseudo-Mercator\", \n  GEOGCS[\"WGS 84\", \n   
 DATUM[\"World Geodetic System 1984\", \n      SPHEROID[\"WGS 84\", 6378137.0, 
298.257223563, AUTHORITY[\"EPSG\",\"7030\"]], \n      
AUTHORITY[\"EPSG\",\"6326\"]], \n    PRIMEM[\"Greenwich\", 0.0, 
AUTHORITY[\"EPSG\",\"8901\"]], \n    UNIT[\"degree\", 0.017453292519943295], \n 
   AXIS[\"Geodetic longitude\", EAST], \n    AXIS[\"Geodetic latitude\", 
NORTH], \n    AUTHORITY[\"EPSG\",\"4326\"]], \n  PROJECTION[\"Popular 
Visualisation Pseudo Mercator\", AUTHORITY[\"EPSG\",\"1024\"]], \n  
PARAMETER[\"semi_minor\", 6378137.0], \n  PARAMETER[\"latitude_of_origin\", 
0.0], \n  PARAMETER[\"central_meridian\", 0.0], \n  PARAMETER[\"scale_factor\", 
1.0], \n  PARAMETER[\"false_easting\", 0.0], \n  PARAMETER[\"false_northing\", 
0.0], \n  UNIT[\"m\", 1.0], \n  AXIS[\"Easting\", EAST], \n  AXIS[\"Northing\", 
NORTH], \n  AUTHORITY[\"EPSG\",\"3857\"]]"
      },
      "srs":"EPSG:3857",
      "nativeBoundingBox":{
         "minx":-2.0037508299778014E7,
         "maxx":2.003121201463195E7,
         "miny":-1.31002474063954E7,
         "maxy":1.3095217057218852E7,
         "crs":{
            "@class":"projected",
            "$":"EPSG:3857"
         }
      },
      "latLonBoundingBox":{
         "minx":-179.99999961362357,
         "maxx":179.94343912182472,
         "miny":-75.3856815938497,
         "maxy":75.37427570459042,
         "crs":"GEOGCS[\"WGS84(DD)\", \n  DATUM[\"WGS84\", \n    
SPHEROID[\"WGS84\", 6378137.0, 298.257223563]], \n  PRIMEM[\"Greenwich\", 0.0], 
\n  UNIT[\"degree\", 0.017453292519943295], \n  AXIS[\"Geodetic longitude\", 
EAST], \n  AXIS[\"Geodetic latitude\", NORTH]]"
      },
      "projectionPolicy":"REPROJECT_TO_DECLARED",
      "enabled":true,
      "metadata":{
         "entry":{
            "@key":"dirName",
            "$":"myraster_myraster"
         }
      },
      "store":{
         "@class":"coverageStore",
         "name":"files:myraster",
         
"href":"http:\/\/localhost:8080\/geoserver\/rest\/workspaces\/files\/coveragestores\/myraster.json"
      },
      "nativeFormat":"GeoTIFF",
      "grid":{
         "@dimension":"2",
         "range":{
            "low":"0 0",
            "high":"3256 2128"
         },
         "transform":{
            "scaleX":12306.118032681192,
            "scaleY":-12309.898714104442,
            "shearX":0,
            "shearY":0,
            "translateX":-2.0031355240761675E7,
            "translateY":1.30890621078618E7
         },
         "crs":"EPSG:3857"
      },
      "supportedFormats":{
         "string":[
            "ArcGrid",
            "GIF",
            "PNG",
            "JPEG",
            "TIFF",
            "Gtopo30",
            "GEOTIFF",
            "ImageMosaic"
         ]
      },
      "interpolationMethods":{
         "string":[
            "nearest neighbor",
            "bilinear",
            "bicubic"
         ]
      },
      "defaultInterpolationMethod":"nearest neighbor",
      "dimensions":{
         "coverageDimension":[
            {
               "name":"RED_BAND",
               "description":"GridSampleDimension[-Infinity,Infinity]",
               "range":{
                  "min":"-inf",
                  "max":"inf"
               },
               "unit":"W.m-2.Sr-1",
               "dimensionType":{
                  "name":"UNSIGNED_8BITS"
               }
            },
            {
               "name":"GREEN_BAND",
               "description":"GridSampleDimension[-Infinity,Infinity]",
               "range":{
                  "min":"-inf",
                  "max":"inf"
               },
               "unit":"W.m-2.Sr-1",
               "dimensionType":{
                  "name":"UNSIGNED_8BITS"
               }
            },
            {
               "name":"BLUE_BAND",
               "description":"GridSampleDimension[-Infinity,Infinity]",
               "range":{
                  "min":"-inf",
                  "max":"inf"
               },
               "unit":"W.m-2.Sr-1",
               "dimensionType":{
                  "name":"UNSIGNED_8BITS"
               }
            }
         ]
      },
      "requestSRS":{
         "string":[
            "EPSG:3857"
         ]
      },
      "responseSRS":{
         "string":[
            "EPSG:3857"
         ]
      },
      "parameters":{
         "entry":[
            {
               "string":"InputTransparentColor",
               "null":""
            },
            {
               "string":[
                  "SUGGESTED_TILE_SIZE",
                  "512,512"
               ]
            }
         ]
      },
      "nativeCoverageName":"myraster"
   }
}
------------------------------------------------------------------------------
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
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to