NetCDF über WCS -Protiocol mit Python und Mapserver servierenPython

Python-Programme
Anonymous
 NetCDF über WCS -Protiocol mit Python und Mapserver servieren

Post by Anonymous »

Ich möchte eine netCDF -Ressource über WCS unter Verwendung von Mapserver Python -Bindungen bedienen. "https: // mydomain/get_wcs/test/wcs"
Meine API basiert auf Fastapi und die Methode get_wcs sieht aus wie:

Code: Select all

@router.get('/get_wcs/{data_id}/wcs', response_class=Response)
async def get_wcs(data_id: str, full_request: Request):
print('hoi!')
map = mapscript.mapObj('/app/data/nc.map')
print(map)
ows_req = mapscript.OWSRequest()
ows_req.setParameter('service', 'wcs')
ows_req.setParameter('version', '2.0.0')
ows_req.setParameter('request', 'getcoverage')
ows_req.setParameter('coverageid', 'precipitation')
ows_req.setParameter('format', 'netCDF')

ows_req.type = mapscript.MS_GET_REQUEST
print(ows_req)
format = map.getOutputFormatByName("netCDF")
print(format)
mapscript.msIO_installStdoutToBuffer()
dispatch_status = map.OWSDispatch(ows_req)
result = mapscript.msIO_getStdoutBufferBytes()
print(result)
content_type = mapscript.msIO_stripStdoutBufferContentType()
print(content_type)
#print('so far no errors')
#pass
ows_req.setParameter("REQUEST", "GetCapabilities")
mapscript.msIO_installStdoutToBuffer()
dispatch_status = map.OWSDispatch(ows_req)
if dispatch_status != mapscript.MS_SUCCESS:
if os.getenv('DEBUG') == '1':
logging.debug(f"DISPATCH status: {dispatch_status}")
mapscript.msIO_stripStdoutBufferContentHeaders()
_result = mapscript.msIO_getStdoutBufferBytes()
content_type = 'text/xml'
dom = xml.dom.minidom.parseString(_result)
result_xml = dom.toprettyxml(indent="", newl="")
return Response(result_xml, media_type=content_type)
Das Ergebnis Objekt scheint ein binärer Stream zu sein (was ich wohl richtig ist), aber an diesem Punkt habe ich mich verloren, da ich nicht wirklich weiß, was ich mit der richtigen Anfrage umgeht. QGIS (es sieht aus wie folgt): < /p>

Code: Select all

    


First Test Service
Test Abstract

keyword
list

OGC WCS
2.0.1
1.1.1
1.0.0
http://www.opengis.net/spec/WCS/2.0/conf/core
http://www.opengis.net/spec/WCS_protocol-binding_get-kvp/1.0/conf/get-kvp
http://www.opengis.net/spec/WCS_protocol-binding_post-xml/1.0/conf/post-xml
http://www.opengis.net/spec/GMLCOV/1.0/conf/gml-coverage
http://www.opengis.net/spec/GMLCOV/1.0/conf/multipart
http://www.opengis.net/spec/GMLCOV/1.0/conf/special-format
http://www.opengis.net/spec/GMLCOV_geotiff-coverages/1.0/conf/geotiff-coverage
http://www.opengis.net/spec/WCS_service-extension_crs/1.0/conf/crs
http://www.opengis.net/spec/WCS_service-extension_scaling/1.0/conf/scaling
http://www.opengis.net/spec/WCS_service-extension_range-subsetting/1.0/conf/record-subsetting
http://www.opengis.net/spec/WCS_service-extension_interpolation/1.0/conf/interpolation
NONE
NONE


OSGeo


Name FamilyName
Software Developer


(000) 000-0000
(000) 000-00000000


000 Xoxox Rd
City
Province
xxx xxx
World
epi@epi.com


0800h - 1600h EST
during hours of service

staff










XML













XML













XML








application/x-netCDF


NEAREST
AVERAGE
BILINEAR


http://www.opengis.net/def/crs/EPSG/0/4326





precipitation
RectifiedGridCoverage




Mein Ziel ist es, diese Schicht (Niederschlag) in QGIS zu laden und die Unterliefdaten visualisieren/abzufragen. Der Testdatensatz wurde auch von der Mapserver -Testsuite ausgeliehen.
Vielen Dank für einen Rat!

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post