Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18906

Get image from multipart response from a Web Coverage Service (WCS) using python

$
0
0

I'm trying to get elevation data from a WCS service using python and owslib. I managed to get a response but I haven't managed to extract the useful information.

This code provides an example of the response

from owslib.wcs import WebCoverageServicewcs_url = "https://geo.api.vlaanderen.be/DHMV/wcs?"bbox_vla = (102200, 192500, 102700, 193000)# Connect to WCS servicewcs = WebCoverageService(wcs_url)response = wcs.getCoverage(identifier=['DHMVII_DTM_1m'],    bbox=bbox_vla,    format='image/tiff',    crs='EPSG:31370',    subsets= [('x', 102200, 102700), ('y', 192500, 193000)],    scalefactor=2)

The response information says the content-type is 'multipart/related'.

{'Date': 'Thu, 18 Jan 2024 08:35:44 GMT', 'Content-Type': 'multipart/related; boundary="wcs";start="GML-Part";type="text/xml"', 'Content-Length': '131127', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Server': 'Microsoft-IIS/10.0', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'X-Powered-By': 'ARR/3.0, ASP.NET', 'Access-Control-Allow-Origin': '*'}

I have been trying to get the .tif file using the email library but I have'nt been able to do it. Does anyone know a library or a way to get the .tif file? There's a similar question in the forum, but it has no answers.

Thanks in advance.


Viewing all articles
Browse latest Browse all 18906


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>