PHP/MapScript getShape() failing with an index returned by getResult() - PostGIS layer

Doug B ummmmm22 at GMAIL.COM
Thu Feb 22 14:49:39 EST 2007


RHEL 4
MapServer 4.8.4
PHP 4.4.5
Postgres 7.4.16
PostGIS 1.2.1

$layer->queryByRect(...);
$numResults = $layer->getNumResults(); // returns 88 results, which is correct
$layer->open();
for ($i = 0; $i < $numResults; $i++)
{
    $result = $layer->getResult($i);
    // echo $result->shapeindex shows all different values that look reasonable
    $shape = $layer->getShape(-1, $result->shapeindex);
    ...
}

The getShape() call returns nothing.  If I try to echo the shape
object itself, it's blank, and not surprisingly all of the attributes
are as well, including index.

On an older system (MapServer 4.2, Postgres 7.4.3, PostGIS 0.9) this
code works correctly, and I can't see what we could be doing wrong
between asking the layer for a shapeindex and asking the layer for the
shape at that shapeindex.  The database appears to contain valid data,
and the query sees enough of it to find the correct number of results.

Thanks for any advice.
Doug



More information about the mapserver-users mailing list