Getting shape values from a PostGIS layer - i really need help

Mathieu Parent mathieuparent at INFONIE.FR
Sat Sep 4 07:28:00 EDT 2004


  Mathieu Parent a écrit :

> Hi,
> How can I get values when I make a query in PHP/MapScript on a PostGIS
> layer ?
>
> Examples :
> _layer's properties :_
>     CONNECTION "user=user password=pass dbname=postgis host=localhost
> port=5432"
>     CONNECTIONTYPE POSTGIS
>     DATA "the_geom from adres"
>
> _part of the script :_
>           if(($num_results=$layer->getNumResults())>0) {
>             $layer->open();
>             for($j=0;$j<$num_results;$j++) {
>               $result=$layer->getResult($j);
>
> $shape=$layer->getShape($result->tileindex,$result->shapeindex);
>               foreach($shape->values AS $field=>$value) {
>                 echo "$field=>$value<br>\n";
>               }
>             }
>             $layer->close();
>
> thanks

The problem is : $shape->values is an empy array (because $layer is not
a ShapeFile)
how can i get the values associated with the geom ?



More information about the mapserver-users mailing list