[Mapserver-users] Read all fields of dbf file when querying

Stefan Schwarzer stefan.schwarzer at grid.unep.ch
Thu Aug 7 10:07:25 EDT 2003


--=====================_28983890==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Thanks Daniel,

but unfortunately I do not know the names of the fields, so that I can't 
access the fields like "$population = $shape->values["Population"];", but 
rather I should retrieve the results by using the column-number [0, 1, 2, 
....]. But this does not work. Any further suggestion?

Stefan


>Stefan Schwarzer wrote:
>>can anyone give me a hint/an example on how can I read with mapscript/PHP 
>>*all fields* in the dbf-part of a shapefile? For a couple of layers I 
>>would like to display upon a query request all fields - and not those 
>>predefined in the METADATA tag.
>
>When you read query results using $layer->getShape(), the shapeObj 
>contains an array member called 'values' that contains all the field 
>values for this shape.  See the shapeObj docs at 
>http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#ShapeObj
>
>--
>------------------------------------------------------------
>  Daniel Morissette               morissette at dmsolutions.ca
>  DM Solutions Group              http://www.dmsolutions.ca/
>------------------------------------------------------------

         _______________________________________

         Stefan Schwarzer
         Consultant on GEO

         UNEP/DEWA/GRID-Geneva
         Chemin des Anemones 11
         CH - 1219 Chatelaine
         Switzerland

         Tel: (+41) 22.917.83.49
         Fax: (+41) 22.917.80.29

         Email: stefan.schwarzer at grid.unep.ch
         Internet: http://geodata.grid.unep.ch/
         _______________________________________ 
--=====================_28983890==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
<font size=3>Thanks Daniel,<br><br>
but unfortunately I do not know the names of the fields, so that I can't
access the fields like
&quot;</font><font size=3 color="#FF0000">$population =
$shape-&gt;values[&quot;Population&quot;];</font><font size=3>&quot;, but
rather I should retrieve the results by using the column-number [0, 1, 2,
....]. But this does not work. Any further suggestion?<br><br>
Stefan<br><br>
<br>
<blockquote type=cite class=cite cite>Stefan Schwarzer wrote:<br>
<blockquote type=cite class=cite cite>can anyone give me a hint/an
example on how can I read with mapscript/PHP *all fields* in the dbf-part
of a shapefile? For a couple of layers I would like to display upon a
query request all fields - and not those predefined in the METADATA
tag.<br>
</blockquote><br>
When you read query results using $layer-&gt;getShape(), the shapeObj
contains an array member called 'values' that contains all the field
values for this shape.&nbsp; See the shapeObj docs at
<a href="http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#ShapeObj" eudora="autourl">http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#ShapeObj</a><br><br>
-- <br>
------------------------------------------------------------<br>
&nbsp;Daniel
Morissette&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
morissette at dmsolutions.ca<br>
&nbsp;DM Solutions
Group&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://www.dmsolutions.ca/" eudora="autourl">http://www.dmsolutions.ca/</a><br>
------------------------------------------------------------</blockquote>
<x-sigsep><p></x-sigsep>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________<br><br>
</font><font size=2><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><b>Stefan
Schwarzer<br>
</b><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Consultant
on GEO<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Chemin des
Anemones 11<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CH - 1219
Chatelaine<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Switzerland<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Internet:
<a href="http://geodata.grid.unep.ch/" eudora="autourl">http://geodata.grid.unep.ch/</a><br>
</font><font size=3><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________</font></body>
</html>

--=====================_28983890==.ALT--




More information about the mapserver-users mailing list