[postgis-users] Problem with PostGIS MapServer layer

Doug B ummmmm22 at gmail.com
Tue Feb 27 17:58:38 PST 2007


I've posted this on the MapServer list as well, but so far don't have
any resolution.  Thought I'd try here as well in case it's a PostGIS
thing.

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.

I do have both GIST and oid indices on the database tables, and my
MapServer DATA layer is the simple form:

DATA "geom from sows_offenders"

Thanks for any advice.
Doug



More information about the postgis-users mailing list