<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>getShape index offset in OGR</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi List,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I'm trying to obtain the attributes for a layer in php_mapscript, </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> $oShape = $oLayer->getShape(-1, 0);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $fieldnames = array_keys ($oShape->values);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">That should work, and does for shapefiles. However, when using a personal geodatabase (and maybe other OGR sources), the index seems to refer to the internal index of the MDB (the 'OBJECTID' as reported in ArcGIS). So to get the first object is a challenge. Currently I'm doing:</FONT></P>
<P><FONT SIZE=2 FACE="Arial"> $oShape = $oLayer->getShape(-1, 0);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $increasedIndex=1;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> while ((!($oShape)) && ($increasedIndex<100))</FONT>
<BR><FONT SIZE=2 FACE="Arial"> {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $oShape = $oLayer->getShape(-1, $increasedIndex);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $increasedIndex++;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> }</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">This is 'messy', and probably not the proper way to go. Can someone tell me how to find the lowerbound (and maybe upperbound) of an OGR layer?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thanks in advance,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Jacob</FONT>
</P>
<BR>
<P><B><FONT COLOR="#009500" FACE="Arial">J</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">ACOB</FONT> <FONT COLOR="#009500" FACE="Arial">D</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">ELFOS<BR>
</FONT><FONT COLOR="#009500" FACE="Arial">GIS</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial"></FONT> <FONT COLOR="#009500" FACE="Arial">A</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">NALYST</FONT><BR>
</B><FONT COLOR="#000000" SIZE=2 FACE="Arial">Maunsell Australia Pty Ltd<BR>
629 Newcastle Street, Leederville, WA 6007</FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">PO Box 81, Leederville, WA 6902</FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">Western Australia</FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">ABN 20 093 846 925<BR>
<BR>
Tel + 61 8 9281 6185<BR>
Fax + 61 8 9281 6297<BR>
</FONT><U><FONT COLOR="#009C21" SIZE=2 FACE="Arial">jacob.delfos@maunsell.com</FONT></U>
</P>
</BODY>
</HTML>