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

Function msWCSWriteFile20

mapwcs20.c:1949–2158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1947/************************************************************************/
1948
1949static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr params, int multipart)
1950{
1951 int status;
1952 char* filename = NULL;
1953 const char *fo_filename;
1954 int i;
1955
1956 fo_filename = msGetOutputFormatOption( image->format, "FILENAME", NULL );
1957
1958 /* -------------------------------------------------------------------- */
1959 /* Fetch the driver we will be using and check if it supports */
1960 /* VSIL IO. */
1961 /* -------------------------------------------------------------------- */
1962#ifdef GDAL_DCAP_VIRTUALIO
1963 if( EQUALN(image->format->driver,"GDAL/",5) )
1964 {
1965 GDALDriverH hDriver;
1966 const char *pszExtension = image->format->extension;
1967
1968 msAcquireLock( TLOCK_GDAL );
1969 hDriver = GDALGetDriverByName( image->format->driver+5 );
1970 if( hDriver == NULL )
1971 {
1972 msReleaseLock( TLOCK_GDAL );
1973 msSetError( MS_MISCERR,
1974 "Failed to find %s driver.",
1975 "msWCSWriteFile20()",
1976 image->format->driver+5 );
1977 return msWCSException(map, "mapserv", "NoApplicableCode",
1978 params->version);
1979 }
1980
1981 if( pszExtension == NULL )
1982 pszExtension = "img.tmp";
1983
1984 if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL )
1985 != NULL )
1986 {
1987 if( fo_filename )
1988 filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
1989 fo_filename,NULL));
1990 else
1991 filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
1992 "out", pszExtension ));
1993
1994 /* CleanVSIDir( "/vsimem/wcsout" ); */
1995
1996 msReleaseLock( TLOCK_GDAL );
1997 status = msSaveImage(map, image, filename);
1998 if( status != MS_SUCCESS )
1999 {
2000 msSetError(MS_MISCERR, "msSaveImage() failed",
2001 "msWCSWriteFile20()");
2002 return msWCSException20(map, "mapserv", "NoApplicableCode",
2003 params->version);
2004 }
2005 }
2006 msReleaseLock( TLOCK_GDAL );

Callers 1

msWCSGetCoverage20Function · 0.85

Calls 14

msGetOutputFormatOptionFunction · 0.85
msAcquireLockFunction · 0.85
msReleaseLockFunction · 0.85
msSetErrorFunction · 0.85
msWCSExceptionFunction · 0.85
msStrdupFunction · 0.85
msSaveImageFunction · 0.85
msWCSException20Function · 0.85
msIO_fprintfFunction · 0.85
msIO_needBinaryStdoutFunction · 0.85
msDebugFunction · 0.85
msIO_printfFunction · 0.85

Tested by

no test coverage detected