MCPcopy Create free account
hub / github.com/MapServer/MapServer / msPrepareWMSLayerRequest

Function msPrepareWMSLayerRequest

mapwmslayer.c:936–1383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934 **********************************************************************/
935
936int msPrepareWMSLayerRequest(int nLayerId, mapObj *map, layerObj *lp,
937 enum MS_CONNECTION_TYPE lastconnectiontype,
938 wmsParamsObj *psLastWMSParams,
939 httpRequestObj *pasReqInfo, int *numRequests)
940{
941#ifdef USE_WMS_LYR
942 char *pszURL = NULL, *pszHTTPCookieData = NULL;
943 const char *pszTmp;
944 rectObj bbox;
945 int bbox_width, bbox_height;
946 int nTimeout, bOkToMerge, bForceSeparateRequest, bCacheToDisk;
947 wmsParamsObj sThisWMSParams;
948
949 char *pszProxyHost=NULL;
950 long nProxyPort=0;
951 char *pszProxyUsername=NULL, *pszProxyPassword=NULL;
952 char *pszHttpAuthUsername=NULL, *pszHttpAuthPassword=NULL;
953 enum MS_HTTP_AUTH_TYPE eHttpAuthType = MS_BASIC;
954 enum MS_HTTP_AUTH_TYPE eProxyAuthType = MS_BASIC;
955 enum MS_HTTP_PROXY_TYPE eProxyType = MS_HTTP;
956
957 if (lp->connectiontype != MS_WMS)
958 return MS_FAILURE;
959
960 msInitWmsParamsObj(&sThisWMSParams);
961
962/* ------------------------------------------------------------------
963 * Build the request URL, this will also set layer projection and
964 * compute BBOX in that projection.
965 * ------------------------------------------------------------------ */
966 if ( msBuildWMSLayerURL(map, lp, WMS_GETMAP,
967 0, 0, 0, NULL, &bbox, &bbox_width, &bbox_height,
968 &sThisWMSParams) != MS_SUCCESS)
969 {
970 /* an error was already reported. */
971 msFreeWmsParamsObj(&sThisWMSParams);
972 return MS_FAILURE;
973 }
974
975/* ------------------------------------------------------------------
976 * Check if the request is empty, perhaps due to reprojection problems
977 * or wms_extents restrictions.
978 * ------------------------------------------------------------------ */
979 if( bbox_width == 0 || bbox_height == 0 )
980 {
981 msFreeWmsParamsObj(&sThisWMSParams);
982 return MS_SUCCESS; /* No overlap. */
983 }
984
985/* ------------------------------------------------------------------
986 * Check if layer overlaps current view window (using wms_latlonboundingbox)
987 * ------------------------------------------------------------------ */
988 if ((pszTmp = msOWSLookupMetadata(&(lp->metadata),
989 "MO", "latlonboundingbox")) != NULL)
990 {
991 char **tokens;
992 int n;
993 rectObj ext;

Callers 2

msDrawMapFunction · 0.85
msDrawWMSLayerFunction · 0.85

Calls 15

msInitWmsParamsObjFunction · 0.85
msBuildWMSLayerURLFunction · 0.85
msFreeWmsParamsObjFunction · 0.85
msOWSLookupMetadataFunction · 0.85
msStringSplitFunction · 0.85
msSetErrorFunction · 0.85
msFreeCharArrayFunction · 0.85
msProjectRectFunction · 0.85
msRectOverlapFunction · 0.85
msOWSLookupMetadata2Function · 0.85
msStrdupFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected