How to get Shapefile Attributes in PHP?

listuser HH listuser at HERZSYS.DE
Wed May 3 03:49:35 PDT 2006


John Kim wrote:

>I can draw a points layer just fine using PHP Mapscript. I'd like to access the attributes from PHP. I thought this would be easy but I don't find it documented anywhere and can't find any examples. Can someone clue me in?
>
>Thanks.
>
>John
>
>
>
>p.s. Is it just me or is the list archive website pretty ... weak?  It's very slow and there's no way to see all the search results if there are more than 50.
>  
>
Hi,

if I remember correctly you have to:

1. get a layer
2. open the layer
3. get a feature from the layer with shape- and tileindex
4. get a value from the feature (loop through with the numvalues)
5. close the layer

This should work for queries where you get the used shape- and tileindex 
from the resultobject. To access data from for example a shapefile 
without query you could use the php dbase functions if you have them 
compiled.

Regards

Norbert



More information about the MapServer-users mailing list