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

Function msOGRWriteFromQuery

mapogroutput.c:448–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446/************************************************************************/
447
448int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders )
449
450{
451#ifndef USE_OGR
452 msSetError(MS_OGRERR, "OGR support is not available.",
453 "msOGRWriteFromQuery()");
454 return MS_FAILURE;
455#else
456/* -------------------------------------------------------------------- */
457/* Variable declarations. */
458/* -------------------------------------------------------------------- */
459 OGRSFDriverH hDriver;
460 OGRDataSourceH hDS;
461 const char *storage;
462 const char *fo_filename;
463 const char *form;
464 char datasource_name[MS_MAXPATHLEN];
465 char base_dir[MS_MAXPATHLEN];
466 char *request_dir = NULL;
467 char **ds_options = NULL;
468 char **layer_options = NULL;
469 char **file_list = NULL;
470 int iLayer, i;
471
472/* -------------------------------------------------------------------- */
473/* Fetch the output format driver. */
474/* -------------------------------------------------------------------- */
475 msOGRInitialize();
476
477 hDriver = OGRGetDriverByName( format->driver+4 );
478 if( hDriver == NULL )
479 {
480 msSetError( MS_MISCERR, "No OGR driver named `%s' available.",
481 "msOGRWriteFromQuery()", format->driver+4 );
482 return MS_FAILURE;
483 }
484
485/* -------------------------------------------------------------------- */
486/* Capture datasource and layer creation options. */
487/* -------------------------------------------------------------------- */
488 for( i=0; i < format->numformatoptions; i++ )
489 {
490 if( strncasecmp(format->formatoptions[i],"LCO:",4) == 0 )
491 layer_options = CSLAddString( layer_options,
492 format->formatoptions[i] + 4 );
493 if( strncasecmp(format->formatoptions[i],"DSCO:",5) == 0 )
494 ds_options = CSLAddString( ds_options,
495 format->formatoptions[i] + 5 );
496 }
497
498/* ==================================================================== */
499/* Determine the output datasource name to use. */
500/* ==================================================================== */
501 storage = msGetOutputFormatOption( format, "STORAGE", "filesystem" );
502
503/* -------------------------------------------------------------------- */
504/* Where are we putting stuff? */
505/* -------------------------------------------------------------------- */

Callers 1

msReturnTemplateQueryFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
msOGRInitializeFunction · 0.85
strncasecmpFunction · 0.85
msGetOutputFormatOptionFunction · 0.85
msTmpFileFunction · 0.85
msBuildPathFunction · 0.85
msFreeFunction · 0.85
msIO_fprintfFunction · 0.85
msOGRCleanupDSFunction · 0.85
msProjectionsDifferFunction · 0.85
msOWSLookupMetadataFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected