0

My image is in Raspberry Pi, GeoServer is in a client system. I want upload the image from Raspberry Pi to GeoServer using HTTP POST. I have read lot of documentations but everything says how to retrieve data.

With WCS request I have tried like this but no response:

from owslib.wcs import WebCoverageService
from owslib.coverage import Coverage
import gdal

Open the image file

ds = gdal.Open('/home/pi/Desktop/Camera Module/image.jpg')

Get the bounding box

xmin, xres, xskew, ymax, yskew, yres = ds.GetGeoTransform() xmax = xmin + (ds.RasterXSize * xres) ymin = ymax + (ds.RasterYSize * yres) bbox = (xmin, ymin, xmax, ymax) print('Bounding box:', bbox)

Get the size

size = (ds.RasterXSize, ds.RasterYSize) print('Size:', size)

Close the image file

ds = None

Connect to GeoServer WCS service

wcs = WebCoverageService('http://ipadddress:port/geoserver/wcs', version='2.0.1')

Define the coverage

bbox = bbox# longitude, latitude coordinates size = size # image size in pixels crs = 'EPSG:4326' # coordinate reference system coverage = Coverage('myimage', bbox, crs, size)

Send the image

response = wcs.getCoverage(identifier='myimage', format='image/tiff', coverage=coverage) with open('myimage.tiff', 'wb') as f: f.write(response.read())

nmtoken
  • 13,355
  • 5
  • 38
  • 87
Raj
  • 11
  • 2

1 Answers1

1

There is no such thing as a WCS-T (transactional) in GeoServer: you can only use the WCS requests to download data.

However, you can upload data using the REST API.

See: Creating Coveragestore GeoTIFF using REST API

Andrea Aime
  • 17,410
  • 1
  • 18
  • 28