<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=136102120-19052004>Hi 
Dave,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=136102120-19052004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=136102120-19052004>I 
checked the code that we hqave for reading and writting shapefiles, an it seems 
that the guy who wrote it "forgot" to write the extent in the shx file 
:-(</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=136102120-19052004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=136102120-19052004>Stephane</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=136102120-19052004><A 
href="http://www.exotk.org">http://www.exotk.org</A></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=136102120-19052004></SPAN></FONT>&nbsp;</DIV>
<BLOCKQUOTE>
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> 
  shapelib-bounces@lists.maptools.org 
  [mailto:shapelib-bounces@lists.maptools.org]<B>On Behalf Of 
  </B>David.Gancarz@ci.orlando.fl.us<BR><B>Sent:</B> Wednesday, May 19, 2004 
  3:27 PM<BR><B>To:</B> Shapelib Development<BR><B>Cc:</B> 'Frank Warmerdam'; 
  shapelib-bounces@lists.maptools.org; Shapelib Development<BR><B>Subject:</B> 
  RE: [Shapelib] possible bug when reading the boundaries 
  ?<BR><BR></FONT></DIV><BR><FONT face=sans-serif size=2>ESRI does, in fact, 
  state that the organization of the 100-byte header in the index file is 
  identical to the main file header -- presumably this means the contents are 
  identical, as well; although that is not stated explicitly. &nbsp;This raises 
  the obvious question then: &nbsp;what is the history of your shapefile? 
  &nbsp;What might have caused its shx header to become different from its shp 
  header?</FONT> <BR><BR><FONT face=sans-serif size=2>Dave Gancarz</FONT> 
  <BR><BR><BR><BR>
  <TABLE width="100%">
    <TBODY>
    <TR vAlign=top>
      <TD width="40%"><FONT face=sans-serif size=1><B>Stephane Routelous 
        &lt;route@CAE.COM&gt;</B> </FONT><BR><FONT face=sans-serif size=1>Sent 
        by: shapelib-bounces@lists.maptools.org</FONT> 
        <P><FONT face=sans-serif size=1>05/19/2004 02:53 PM</FONT> 
        <TABLE border=1>
          <TBODY>
          <TR vAlign=top>
            <TD bgColor=white>
              <DIV align=center><FONT face=sans-serif size=1>Please respond 
              to<BR>Shapelib Development 
              &lt;shapelib@lists.maptools.org&gt;</FONT></DIV></TR></TBODY></TABLE><BR></P>
      <TD width="59%">
        <TABLE width="100%">
          <TBODY>
          <TR>
            <TD>
              <DIV align=right><FONT face=sans-serif size=1>To</FONT></DIV>
            <TD vAlign=top><FONT face=sans-serif size=1>"'Frank Warmerdam'" 
              &lt;warmerdam@pobox.com&gt;, Shapelib Development 
              &lt;shapelib@lists.maptools.org&gt;</FONT> 
          <TR>
            <TD>
              <DIV align=right><FONT face=sans-serif size=1>cc</FONT></DIV>
            <TD vAlign=top>
          <TR>
            <TD>
              <DIV align=right><FONT face=sans-serif size=1>Subject</FONT></DIV>
            <TD vAlign=top><FONT face=sans-serif size=1>RE: [Shapelib] 
              possible bug when reading the boundaries 
        ?</FONT></TR></TBODY></TABLE><BR>
        <TABLE>
          <TBODY>
          <TR vAlign=top>
            <TD>
            <TD></TR></TBODY></TABLE><BR></TR></TBODY></TABLE><BR><BR><BR><FONT 
  size=2><TT>Hi Frank,<BR><BR>Yes, I have a shape file where your code give me 
  wrong results for the<BR>boundaries (<BR>xmin == ymin == 999999999<BR>xmax == 
  ymax == -999999999 ) where min &gt; max<BR><BR>If you want, I can send you the 
  files.<BR><BR>what about <BR>if ( boundaries in shx are not valid 
  )<BR>readBoundariesFronShp();<BR>?<BR><BR>Stephane 
  Routelous<BR>http://www.exotk.org<BR><BR><BR><BR><BR><BR>-----Original 
  Message-----<BR>From: Frank Warmerdam [mailto:warmerdam@pobox.com]<BR>Sent: 
  Wednesday, May 19, 2004 12:42 PM<BR>To: Shapelib Development; 
  route@cae.com<BR>Subject: Re: [Shapelib] possible bug when reading the 
  boundaries ?<BR><BR><BR>Stephane Routelous wrote:<BR>&gt; Hi,<BR>&gt; <BR>&gt; 
  I'm investigating using ShapeLib instead of our own library because of<BR>&gt; 
  performace issues.<BR>&gt; <BR>&gt; I think I found a bug in the code for 
  reading the bounds of a shape file<BR>in<BR>&gt; SHPOpen<BR>&gt; at line 448, 
  you have :<BR>&gt; &nbsp; &nbsp; fread( pabyBuf, 100, 1, psSHP-&gt;fpSHX 
  );<BR>&gt; meaning that you are reading informations from the shx 
  file.<BR>&gt; <BR>&gt; But after, you are reading the bounds with :<BR>&gt; 
  &nbsp; &nbsp; if( bBigEndian ) SwapWord( 8, pabyBuf+36 ); //line 480<BR>&gt; 
  &nbsp; &nbsp; memcpy( &amp;dValue, pabyBuf+36, 8 );<BR>&gt; &nbsp; &nbsp; 
  psSHP-&gt;adBoundsMin[0] = dValue;<BR>&gt; <BR>&gt; it means that the bounds 
  are read from the SHX file, but according to the<BR>&gt; specifications, the 
  bounds are in the SHP file.<BR>&gt; So, I think you should move the reading of 
  the boundaries before the line<BR>&gt; 448.<BR><BR>Stephane,<BR><BR>Generally 
  speaking the first 100 byte header of the SHP and SHX files are<BR>the same. 
  &nbsp;One could argue about which should be consider 
  "more<BR>authoritative"<BR>if they differ but I haven't really run into a 
  problem with this so I am not<BR>inclined to change it for hypothetical 
  reasons.<BR><BR>Have you actually encountered a problem with this 
  code?<BR><BR>Best regards,<BR>-- 
  <BR>---------------------------------------+------------------------------------<BR>--<BR>I 
  set the clouds in motion - turn up &nbsp; | Frank 
  Warmerdam,<BR>warmerdam@pobox.com<BR>light and sound - activate the windows | 
  http://pobox.com/~warmerdam<BR>and watch the world go round - Rush &nbsp; 
  &nbsp;| Geospatial Programmer for 
  Rent<BR>_______________________________________________<BR>Shapelib mailing 
  list<BR>Shapelib@lists.maptools.org<BR>http://lists.maptools.org/mailman/listinfo/shapelib<BR></TT></FONT><BR></BLOCKQUOTE></BODY></HTML>