Skip to content

Commit

Permalink
[OGR] Correctly extract BBOX from a Intersects() filter. Complementar…
Browse files Browse the repository at this point in the history
…y fix to f53fd78
  • Loading branch information
rouault committed Jun 19, 2017
1 parent 1df03be commit aae74ff
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mapogr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3268,14 +3268,15 @@ static msExprNode* BuildExprTree(tokenListNodeObjPtr node,
{
if( node->next && node->next->token == '(' )
{
int node_token = node->token;
msExprNode* subExpr = BuildExprTree(node->next->next, &node,
nParenthesisLevel + 1);
if( subExpr == NULL )
{
goto fail;
}
msExprNode* newNode = new msExprNode;
newNode->m_nToken = node->token;
newNode->m_nToken = node_token;
if( subExpr->m_nToken == 0 )
{
newNode->m_aoChildren = subExpr->m_aoChildren;
Expand Down Expand Up @@ -3393,6 +3394,8 @@ static msExprNode* BuildExprTree(tokenListNodeObjPtr node,

/**********************************************************************
* msOGRExtractTopSpatialFilter()
*
* Recognize expressions like "Intersects([shape], wkt) == TRUE [AND ....]"
**********************************************************************/
static int msOGRExtractTopSpatialFilter( msOGRFileInfo *info,
const msExprNode* expr,
Expand All @@ -3401,6 +3404,15 @@ static int msOGRExtractTopSpatialFilter( msOGRFileInfo *info,
if( expr == NULL )
return MS_FALSE;

if( expr->m_nToken == MS_TOKEN_COMPARISON_EQ &&
expr->m_aoChildren.size() == 2 &&
expr->m_aoChildren[1]->m_nToken == MS_TOKEN_LITERAL_BOOLEAN &&
expr->m_aoChildren[1]->m_dfVal == 1.0 )
{
return msOGRExtractTopSpatialFilter(info, expr->m_aoChildren[0],
pSpatialFilterNode);
}

if( expr->m_nToken == MS_TOKEN_COMPARISON_INTERSECTS &&
expr->m_aoChildren.size() == 2 &&
expr->m_aoChildren[1]->m_nToken == MS_TOKEN_LITERAL_SHAPE )
Expand Down

0 comments on commit aae74ff

Please sign in to comment.