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

Function msBuildWMSLayerURL

mapwmslayer.c:460–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458#define WMS_GETFEATUREINFO 2
459
460static int
461msBuildWMSLayerURL(mapObj *map, layerObj *lp, int nRequestType,
462 int nClickX, int nClickY, int nFeatureCount,
463 const char *pszInfoFormat, rectObj *bbox_ret,
464 int *width_ret, int *height_ret,
465 wmsParamsObj *psWMSParams)
466{
467#ifdef USE_WMS_LYR
468 char *pszEPSG = NULL;
469 const char *pszVersion, *pszTmp, *pszRequestParam, *pszExceptionsParam, *pszQueryLayers=NULL;
470 rectObj bbox;
471 int bbox_width = map->width, bbox_height = map->height;
472 int nVersion=OWS_VERSION_NOTSET;
473
474 if (lp->connectiontype != MS_WMS)
475 {
476 msSetError(MS_WMSCONNERR, "Call supported only for CONNECTIONTYPE WMS",
477 "msBuildWMSLayerURL()");
478 return MS_FAILURE;
479 }
480
481/* ------------------------------------------------------------------
482 * Find out request version
483 * ------------------------------------------------------------------ */
484 if (lp->connection == NULL ||
485 ((pszVersion = strstr(lp->connection, "VERSION=")) == NULL &&
486 (pszVersion = strstr(lp->connection, "version=")) == NULL &&
487 (pszVersion = strstr(lp->connection, "WMTVER=")) == NULL &&
488 (pszVersion = strstr(lp->connection, "wmtver=")) == NULL ) )
489 {
490 /* CONNECTION missing or seems incomplete... try to build from metadata */
491 if (msBuildWMSLayerURLBase(map, lp, psWMSParams) != MS_SUCCESS)
492 return MS_FAILURE; /* An error already produced. */
493
494 /* If we received MS_SUCCESS then version must have been set */
495 pszVersion = msLookupHashTable(psWMSParams->params, "VERSION");
496 if (pszVersion ==NULL)
497 pszVersion = msLookupHashTable(psWMSParams->params, "WMTVER");
498
499 nVersion = msOWSParseVersionString(pszVersion);
500 }
501 else
502 {
503 /* CONNECTION string seems complete, start with that. */
504 char *pszDelimiter;
505 psWMSParams->onlineresource = msStrdup(lp->connection);
506
507 /* Fetch version info */
508 pszVersion = strchr(pszVersion, '=')+1;
509 pszDelimiter = strchr(pszVersion, '&');
510 if (pszDelimiter != NULL)
511 *pszDelimiter = '\0';
512 nVersion = msOWSParseVersionString(pszVersion);
513 if (pszDelimiter != NULL)
514 *pszDelimiter = '&';
515 }
516
517 switch (nVersion)

Callers 2

msWMSGetFeatureInfoURLFunction · 0.85
msPrepareWMSLayerRequestFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
msBuildWMSLayerURLBaseFunction · 0.85
msLookupHashTableFunction · 0.85
msOWSParseVersionStringFunction · 0.85
msStrdupFunction · 0.85
msOWSLookupMetadataFunction · 0.85
msOWSGetEPSGProjFunction · 0.85
strncasecmpFunction · 0.85
msProjectPointFunction · 0.85
msSmallMallocFunction · 0.85
strcasecmpFunction · 0.85
msLoadProjectionStringFunction · 0.85

Tested by

no test coverage detected