<!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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oShape = $oLayer-&gt;getShape(-1, 0);</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $fieldnames =&nbsp; array_keys ($oShape-&gt;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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oShape = $oLayer-&gt;getShape(-1, 0);</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $increasedIndex=1;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while ((!($oShape)) &amp;&amp; ($increasedIndex&lt;100))</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oShape = $oLayer-&gt;getShape(-1, $increasedIndex);</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $increasedIndex++;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</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>