Search code examples
curlservergeoservergeotiff

GeoServer access data file reside remotely


I have geoserver installed in my web server and I want to create a GeoTIFF layer. I am accessing geoserver through my local machine and I have GeoTIFF file reside in my local machine. The problem is geoserver doesn't recognize the path of the file I specified so it is unable to create the layer for me.

Below is my curl command,

exec('curl -u admin:geoserver -v -XPUT -H "Content-type:image/tiff" --data-binary "http://192.168.1.2:82/TrueMarble.32km.1350x675.tif" "http://107.167.186.125:8080/geoedge/rest/workspaces/geoedge/coveragestores/st_tif_layer_8/file.geotiff" ');

It creates coverage but doesn't create layer there, Can't I access my file using IP address, should it reside in the same server as geoserver installed.


Solution

  • What you are trying to do is possible but I think your curl syntax is wrong. I would use soemthing like:

    curl -u admin:geoserver -v -XPUT -H "Content-type:image/tiff" --data-binary @TrueMarble.32km.1350x675.tif "http://107.167.186.125:8080/geoedge/rest/workspaces/geoedge/coveragestores/st_tif_layer_8/file.geotiff"
    

    where the file is refered to by name (since it is local) otherwise curl will just send the file name as the data.

    From the curl man page:

    If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. Multiple files can also be specified. Post‐ ing data from a file named 'foobar' would thus be done with --data @foobar. When --data is told to read from a file like that, carriage returns and newlines will be stripped out.