[Mapserver-users] listing field names of my $oShape->values; (Because it's Friday???)

FX Gamoy fx.gamoy@mapxplore.com
Fri, 27 Feb 2004 22:32:31 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C3FD81.96B1A960
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hello
try=20
print_r($oShape);
or
print_r($oShape->values);

fx gamoy
http://www.mapxplore.com/

  ----- Original Message -----=20
  From: Denis Lalonde=20
  To: mapserver-users@lists.gis.umn.edu=20
  Sent: Friday, February 27, 2004 9:34 PM
  Subject: [Mapserver-users] listing field names of my $oShape->values; =
(Because it's Friday???)


  Hello all,
  I'm simply trying to get a list of the field names of a layer...
  I'm using php & mapscipt 4 and accessing my MapInfo data (OGR)
  Here's my code that's not working (I get "Undefined offset" error when =
accessing the array):
  I have my results and my layer set; the result of my echo =
sizeof($flds) is 20 which is good. The item that I am querying does have =
data in all 20 fields.

                      $oRes =3D $oLayer->getResult($iRes);
                      $oShape =3D =
$oLayer->getShape(-1,$oRes->shapeindex);
                     =20
                      $flds=3D$oShape->values;
                      echo "numfields: ".sizeof($flds)."<br>";
                      for ($fieldcount=3D0; $fieldcount < sizeof($flds); =
$fieldcount++)
                          {
                             echo $flds[$fieldcount];
                          }

  should that not spit me out my field names?

  Thanks


-------------------------------------------------------------------------=
-----
  Do you Yahoo!?
  Get better spam protection with Yahoo! Mail
------=_NextPart_000_000A_01C3FD81.96B1A960
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hello</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>try </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print_r($oShape);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>or</FONT></DIV><FONT face=3DArial=20
size=3D2>print_r($oShape-&gt;values);</FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>fx gamoy</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.mapxplore.com/">http://www.mapxplore.com/</A></FONT></=
DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Ddenlalonde@yahoo.com =
href=3D"mailto:denlalonde@yahoo.com">Denis=20
  Lalonde</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
  title=3Dmapserver-users@lists.gis.umn.edu=20
  =
href=3D"mailto:mapserver-users@lists.gis.umn.edu">mapserver-users@lists.g=
is.umn.edu</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, February 27, 2004 =
9:34=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Mapserver-users] =
listing field=20
  names of my $oShape-&gt;values; (Because it's Friday???)</DIV>
  <DIV><BR></DIV>
  <DIV>Hello all,</DIV>
  <DIV>I'm simply trying to get a list of the field names of a =
layer...</DIV>
  <DIV>I'm using php &amp; mapscipt 4 and accessing my MapInfo data =
(OGR)</DIV>
  <DIV>Here's my code that's not working (I get "Undefined offset" error =
when=20
  accessing the array):</DIV>
  <DIV>I have my results and my layer set; the result of my echo =
sizeof($flds)=20
  is 20 which is good. The item that I am querying does have data in all =
20=20
  fields.</DIV>
  =
<DIV><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  $oRes =3D=20
  =
$oLayer-&gt;getResult($iRes);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
  $oShape =3D=20
  =
$oLayer-&gt;getShape(-1,$oRes-&gt;shapeindex);<BR>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
  =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
$flds=3D$oShape-&gt;values;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

  echo "numfields:=20
  =
".sizeof($flds)."&lt;br&gt;";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
  for ($fieldcount=3D0; $fieldcount &lt; sizeof($flds);=20
  =
$fieldcount++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
  =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
  echo=20
  =
$flds[$fieldcount];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
  }</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>should that not spit me out my field names?</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Thanks</DIV>
  <P>
  <HR SIZE=3D1>
  Do you Yahoo!?<BR>Get better spam protection with <A=20
  =
href=3D"http://us.rd.yahoo.com/mailtag_us/*http://antispam.yahoo.com/tool=
s">Yahoo!=20
  Mail</A></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_000A_01C3FD81.96B1A960--

_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users