[mapserver-dev] get features geomerty

Guillaume Sueur guillaume.sueur at neogeo-online.net
Sun Jun 29 04:35:14 EDT 2008


Hi Drew,

I think you should try :
$shape->toWkt()

to get the shape's geometry in a readable format.

Guillaume


cgishack a écrit :
> Hello,
> Is there any way I can get a features geometry from a spatial query.
> I am using PHP/MapScript but can only seem to find ways to get attributes.
> 
> I am using postGIS and tried a method like so.
> 
>        $layer->queryByRect($selectionEnvelope);
>        $status = $layer->open();
>        $status = $layer->whichShapes($selectionEnvelope);
>        while ($shape = $layer->nextShape())
>        {
>                 echo $shape->values["the_geom"]; //<-- postgre field name...
> not
> found
>        }
>        $layer->close();
> 
> I assume i could use plain SQL and PHP to get the data, but I wanted to make
> it work with shapefiles also.
> 
> Any help would be appreciated.
> 
> Drew




More information about the mapserver-dev mailing list