MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWCSReturnCoverage11

Function msWCSReturnCoverage11

mapwcs11.c:1157–1391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1155
1156#if defined(USE_WCS_SVR)
1157int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
1158 imageObj *image )
1159{
1160 int status, i;
1161 char *filename = NULL;
1162 const char *encoding;
1163 const char *fo_filename;
1164
1165 encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding");
1166
1167 fo_filename = msGetOutputFormatOption( image->format, "FILENAME", NULL );
1168
1169/* -------------------------------------------------------------------- */
1170/* Fetch the driver we will be using and check if it supports */
1171/* VSIL IO. */
1172/* -------------------------------------------------------------------- */
1173#ifdef GDAL_DCAP_VIRTUALIO
1174 if( EQUALN(image->format->driver,"GDAL/",5) )
1175 {
1176 GDALDriverH hDriver;
1177 const char *pszExtension = image->format->extension;
1178
1179 msAcquireLock( TLOCK_GDAL );
1180 hDriver = GDALGetDriverByName( image->format->driver+5 );
1181 if( hDriver == NULL )
1182 {
1183 msReleaseLock( TLOCK_GDAL );
1184 msSetError( MS_MISCERR,
1185 "Failed to find %s driver.",
1186 "msWCSReturnCoverage11()",
1187 image->format->driver+5 );
1188 return msWCSException11(map, "mapserv", "NoApplicableCode",
1189 params->version);
1190 }
1191
1192 if( pszExtension == NULL )
1193 pszExtension = "img.tmp";
1194
1195 if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL )
1196 != NULL )
1197 {
1198 if( fo_filename )
1199 filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
1200 fo_filename,NULL));
1201 else
1202 filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
1203 "out", pszExtension ));
1204
1205/* CleanVSIDir( "/vsimem/wcsout" ); */
1206
1207 msReleaseLock( TLOCK_GDAL );
1208 status = msSaveImage(map, image, filename);
1209 if( status != MS_SUCCESS )
1210 {
1211 msSetError(MS_MISCERR, "msSaveImage() failed",
1212 "msWCSReturnCoverage11()");
1213 return msWCSException11(map, "mapserv", "NoApplicableCode",
1214 params->version);

Callers 1

msWCSGetCoverageFunction · 0.85

Calls 11

msOWSLookupMetadataFunction · 0.85
msGetOutputFormatOptionFunction · 0.85
msAcquireLockFunction · 0.85
msReleaseLockFunction · 0.85
msSetErrorFunction · 0.85
msWCSException11Function · 0.85
msStrdupFunction · 0.85
msSaveImageFunction · 0.85
msIO_fprintfFunction · 0.85
msIO_needBinaryStdoutFunction · 0.85
msIO_fwriteFunction · 0.85

Tested by

no test coverage detected