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

Doug B ummmmm22 at GMAIL.COM
Mon Feb 26 09:47:59 EST 2007


Anyone?  Any ideas why layer->getShape() would fail with an index
returned by layer->getResult()?

On 2/22/07, Doug B <ummmmm22 at gmail.com> wrote:
> 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