<!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> </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> </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> </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. This raises
the obvious question then: what is the history of your shapefile?
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
<route@CAE.COM></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
<shapelib@lists.maptools.org></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'"
<warmerdam@pobox.com>, Shapelib Development
<shapelib@lists.maptools.org></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 > 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>> Hi,<BR>> <BR>>
I'm investigating using ShapeLib instead of our own library because of<BR>>
performace issues.<BR>> <BR>> I think I found a bug in the code for
reading the bounds of a shape file<BR>in<BR>> SHPOpen<BR>> at line 448,
you have :<BR>> fread( pabyBuf, 100, 1, psSHP->fpSHX
);<BR>> meaning that you are reading informations from the shx
file.<BR>> <BR>> But after, you are reading the bounds with :<BR>>
if( bBigEndian ) SwapWord( 8, pabyBuf+36 ); //line 480<BR>>
memcpy( &dValue, pabyBuf+36, 8 );<BR>>
psSHP->adBoundsMin[0] = dValue;<BR>> <BR>> it means that the bounds
are read from the SHX file, but according to the<BR>> specifications, the
bounds are in the SHP file.<BR>> So, I think you should move the reading of
the boundaries before the line<BR>> 448.<BR><BR>Stephane,<BR><BR>Generally
speaking the first 100 byte header of the SHP and SHX files are<BR>the same.
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 | 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
| 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>