1

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 documentation 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())

Please don't close my question. I NEED HELP !!!!!!!!!!!

2
  • We need more information to be able to help you
    – Mapperz
    Commented Mar 9, 2023 at 20:03
  • edited the question please check now
    – Raj
    Commented Mar 9, 2023 at 21:00

0

Browse other questions tagged or ask your own question.