[mapserver-commits] r10931 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Feb 2 17:13:15 EST 2011
Author: warmerdam
Date: 2011-02-02 14:13:15 -0800 (Wed, 02 Feb 2011)
New Revision: 10931
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapwcs.c
trunk/mapserver/mapwcs11.c
trunk/mapserver/mapwcs20.c
Log:
support setting filenames for WCS GetCoverage results (#3665)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-02-02 22:12:25 UTC (rev 10930)
+++ trunk/mapserver/HISTORY.TXT 2011-02-02 22:13:15 UTC (rev 10931)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Support setting filenames for WCS GetCoverage results (#3665)
+
- OGR auto-styling: use the color parameter and set the style's opacity when it is available.
Allow symbols that can be stored externally (#3660)
Modified: trunk/mapserver/mapwcs.c
===================================================================
--- trunk/mapserver/mapwcs.c 2011-02-02 22:12:25 UTC (rev 10930)
+++ trunk/mapserver/mapwcs.c 2011-02-02 22:13:15 UTC (rev 10931)
@@ -1783,10 +1783,18 @@
}
else /* WCS 1.0.0 - just return the binary data with a content type */
{
+ const char *fo_filename;
+
+ /* Do we have a predefined filename? */
+ fo_filename = msGetOutputFormatOption( format, "FILENAME", NULL );
+ if( fo_filename )
+ msIO_fprintf( stdout,
+ "Content-Disposition: attachment; filename=%s\n",
+ fo_filename );
+
/* Emit back to client. */
msIO_printf("Content-type: %s%c%c",
MS_IMAGE_MIME_TYPE(map->outputformat), 10,10);
-
status = msSaveImage(map, image, NULL);
if( status != MS_SUCCESS )
Modified: trunk/mapserver/mapwcs11.c
===================================================================
--- trunk/mapserver/mapwcs11.c 2011-02-02 22:12:25 UTC (rev 10930)
+++ trunk/mapserver/mapwcs11.c 2011-02-02 22:13:15 UTC (rev 10931)
@@ -1120,9 +1120,12 @@
int status, i;
char *filename = NULL;
const char *encoding;
+ const char *fo_filename;
encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding");
+ fo_filename = msGetOutputFormatOption( image->format, "FILENAME", NULL );
+
/* -------------------------------------------------------------------- */
/* Fetch the driver we will be using and check if it supports */
/* VSIL IO. */
@@ -1152,10 +1155,15 @@
if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL )
!= NULL )
{
+ if( fo_filename )
+ filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
+ fo_filename,NULL));
+ else
+ filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
+ "out", pszExtension ));
+
/* CleanVSIDir( "/vsimem/wcsout" ); */
- filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
- "out", pszExtension ));
-
+
msReleaseLock( TLOCK_GDAL );
status = msSaveImage(map, image, filename);
if( status != MS_SUCCESS )
Modified: trunk/mapserver/mapwcs20.c
===================================================================
--- trunk/mapserver/mapwcs20.c 2011-02-02 22:12:25 UTC (rev 10930)
+++ trunk/mapserver/mapwcs20.c 2011-02-02 22:13:15 UTC (rev 10931)
@@ -1039,7 +1039,6 @@
xmlFreeDoc(doc);
xmlCleanupParser();
- msDebug("msWCSParseRequest20(): Request parsed\n");
return ret;
#else /* defined(USE_LIBXML2) */
@@ -1574,8 +1573,6 @@
xmlNodePtr psBoundedBy, psEnvelope;
char lowerCorner[100], upperCorner[100], axisLabels[100], uomLabels[100];
- msDebug("msWCSCommon20_CreateBoundedBy\n");
-
psBoundedBy = xmlNewChild( psRoot, psGmlNs, BAD_CAST "boundedBy", NULL);
{
psEnvelope = xmlNewChild(psBoundedBy, psGmlNs, BAD_CAST "Envelope", NULL);
@@ -1618,8 +1615,6 @@
psPos, psOffsetX, psOffsetY;
char low[100], high[100], id[100], point[100], resx[100], resy[100], axisLabels[100];
- msDebug("msWCSCommon20_CreateDomainSet\n");
-
psDomainSet = xmlNewChild( psRoot, psGmlNs, BAD_CAST "domainSet", NULL);
{
psGrid = xmlNewChild(psDomainSet, psGmlNs, BAD_CAST "RectifiedGrid", NULL);
@@ -1833,41 +1828,11 @@
{
int status;
char* filename = NULL;
+ const char *fo_filename;
int i;
- /*if(multipart)
- {
- msIO_fprintf(
- stdout,
- "--wcs\n"
- "Content-Type: %s\n"
- "Content-Description: coverage data\n"
- "Content-Transfer-Encoding: binary\n"
- "Content-ID: coverage/wcs.%s\n"
- "Content-Disposition: INLINE%c%c",
- MS_IMAGE_EXTENSION(map->outputformat),
- MS_IMAGE_MIME_TYPE(map->outputformat),
- MS_IMAGE_EXTENSION(map->outputformat),
- 10, 10 );
- }
- else
- {
- msIO_fprintf(
- stdout,
- "Content-Type: %s\n",
- "Content-Transfer-Encoding: binary\n",
- MS_IMAGE_MIME_TYPE(map->outputformat));
- }
- status = msSaveImage(map, image, NULL);
- if( status != MS_SUCCESS )
- {
- msSetError( MS_MISCERR, "msSaveImage() failed", "msWCSReturnCoverage11()");
- return msWCSException(map, "mapserv", "NoApplicableCode", "2.0.0");
- }
- if(multipart)
- msIO_fprintf( stdout, "--wcs--%c%c", 10, 10 );*/
+ fo_filename = msGetOutputFormatOption( image->format, "FILENAME", NULL );
-
/* -------------------------------------------------------------------- */
/* Fetch the driver we will be using and check if it supports */
/* VSIL IO. */
@@ -1878,8 +1843,6 @@
GDALDriverH hDriver;
const char *pszExtension = image->format->extension;
- msDebug("In GDAL\n");
-
msAcquireLock( TLOCK_GDAL );
hDriver = GDALGetDriverByName( image->format->driver+5 );
if( hDriver == NULL )
@@ -1899,9 +1862,14 @@
if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL )
!= NULL )
{
+ if( fo_filename )
+ filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
+ fo_filename,NULL));
+ else
+ filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
+ "out", pszExtension ));
+
/* CleanVSIDir( "/vsimem/wcsout" ); */
- filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
- "out", pszExtension ));
msReleaseLock( TLOCK_GDAL );
status = msSaveImage(map, image, filename);
@@ -1941,6 +1909,11 @@
}
else
{
+ if( fo_filename != NULL )
+ msIO_fprintf( stdout,
+ "Content-Disposition: attachment; filename=%s\n",
+ fo_filename );
+
msIO_fprintf(
stdout,
"Content-Type: %s\n%c",
@@ -2034,6 +2007,10 @@
}
else
{
+ msIO_fprintf( stdout,
+ "Content-Disposition: attachment; filename=%s\n",
+ all_files[i] );
+
msIO_fprintf(
stdout,
"Content-Type: %s\n%c",
More information about the mapserver-commits
mailing list