Skip to content

PHP mapscript : Can't use queryByIndex result #4926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabien-cat opened this issue May 15, 2014 · 3 comments
Closed

PHP mapscript : Can't use queryByIndex result #4926

fabien-cat opened this issue May 15, 2014 · 3 comments

Comments

@fabien-cat
Copy link

Hello,

I can't use queryByIndex result on Postgis layers (Mapserver 6.4.1, PHP 5.5.12, Postgis 2.0).
$iIndexLayer=1;
$aQueryIndex=new array(2211, 2215);
foreach($aQueryIndex as $iIndex){
$oLayer=$oMap->getLayer($iIndexLayer);
$oLayer->queryByIndex(-1,$iIndex,MS_TRUE);
}

    $oLayer=$oMap->getLayer($iIndexLayer);
    echo $oLayer->getNumResults();  // return 2, it's OK

     for ($i=0; $i<$oLayer->getNumResults(); $i++){
        $oShape=$oLayer->getShape($oLayer->getResult($i));
        echo $oShape->index; // return always 2215, the last one
    }

I've a second problem if I do :
$sMapFile="my_mapfile.map.qy";
$oMap->savequery($sMapFile);
$oMap->loadQuery($sMapFile);

    $oLayer=$oMap->getLayer($iIndexLayer);
    echo $oLayer->getNumResults();  // return 3 instead of 2

If I do a savequery(), the getNumResults() is always increases 1.

I see that issue :
#4076
Indeed, the getNumresults() function works but the result can't be use.

In version 5.4 of Mapserver everything works fine.

I looked the code (mapquery.c), this is complex, maybe there is a problem with the result index ?!

Thanks,

Fabien Marty

mkofahl added a commit to faegi/mapserver that referenced this issue May 28, 2014
@mkofahl
Copy link
Contributor

mkofahl commented May 28, 2014

Thank you, @fabien-cat. With postgis, the result index is always 0, which is the row number. See #4932 for further explanation.

@fabien-cat
Copy link
Author

Thanks @mkofahl , so why there's a good number result but always the same index for Shapes result ?
There's a problem with the function msQueryByIndex() or addResult() ?

mkofahl added a commit that referenced this issue Sep 2, 2014
@mapserver-bot
Copy link

This is an automated comment

This issue has been closed due to lack of activity. This doesn't mean the issue is invalid, it simply got no attention within the last year. Please reopen with missing/relevant information if still valid.

Typically, issues fall in this state for one of the following reasons:

  • Hard, impossible or not enough information to reproduce
  • Missing test case
  • Lack of a champion with interest and/or funding to address the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants