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

Function FLTApplySimpleSQLFilter

mapogcfilter.c:289–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287/************************************************************************/
288
289int FLTApplySimpleSQLFilter(FilterEncodingNode *psNode, mapObj *map,
290 int iLayerIndex)
291{
292 layerObj *lp = NULL;
293 char *szExpression = NULL;
294 rectObj sQueryRect = map->extent;
295 char *szEPSG = NULL;
296 char **tokens = NULL;
297 int nTokens = 0, nEpsgTmp = 0;
298 projectionObj sProjTmp;
299 char *pszBuffer = NULL;
300 int bConcatWhere = 0;
301 int bHasAWhere =0;
302 char *pszTmp = NULL, *pszTmp2 = NULL;
303 size_t bufferSize = 0;
304 char *tmpfilename = NULL;
305
306 lp = (GET_LAYER(map, iLayerIndex));
307
308 /* if there is a bbox use it */
309 szEPSG = FLTGetBBOX(psNode, &sQueryRect);
310 if(szEPSG && map->projection.numargs > 0)
311 {
312#ifdef USE_PROJ
313 nTokens = 0;
314 tokens = msStringSplit(szEPSG,'#', &nTokens);
315 if (tokens && nTokens == 2)
316 {
317 char *szTmp;
318 bufferSize = 10+strlen(tokens[1])+1;
319 szTmp = (char *)malloc(bufferSize);
320 snprintf(szTmp, bufferSize, "init=epsg:%s",tokens[1]);
321 msInitProjection(&sProjTmp);
322 if (msLoadProjectionString(&sProjTmp, szTmp) == 0)
323 msProjectRect(&sProjTmp, &map->projection, &sQueryRect);
324 free(szTmp);
325 }
326 else if (tokens && nTokens == 1)
327 {
328 if (tokens)
329 msFreeCharArray(tokens, nTokens);
330 nTokens = 0;
331
332 tokens = msStringSplit(szEPSG,':', &nTokens);
333 nEpsgTmp = -1;
334 if (tokens && nTokens == 1)
335 {
336 nEpsgTmp = atoi(tokens[0]);
337
338 }
339 else if (tokens && nTokens == 2)
340 {
341 nEpsgTmp = atoi(tokens[1]);
342 }
343 if (nEpsgTmp > 0)
344 {
345 char szTmp[32];
346 snprintf(szTmp, sizeof(szTmp), "init=epsg:%d",nEpsgTmp);

Callers 1

Calls 15

FLTGetBBOXFunction · 0.85
msStringSplitFunction · 0.85
msInitProjectionFunction · 0.85
msLoadProjectionStringFunction · 0.85
msProjectRectFunction · 0.85
msFreeCharArrayFunction · 0.85
msFreeProjectionFunction · 0.85
msStrdupFunction · 0.85
msGrowLayerClassesFunction · 0.85
initClassFunction · 0.85
FLTGetSQLExpressionFunction · 0.85
msStringConcatenateFunction · 0.85

Tested by

no test coverage detected