From kohnicho@comp.nus.edu.sg  Wed Jul 28 09:28:58 1999
From: kohnicho@comp.nus.edu.sg (Nicholas Lewin-Koh)
Date: Wed, 28 Jul 1999 16:28:58 +0800 (SST)
Subject: ESRI shapes --again
Message-ID: <199907280828.QAA23696@decunx.iscs.nus.sg>

thanks to all the help so far I have code now that works on windows
(albeit very clunky) that can read the pertinent info from the shape header
and return a list with all the necessary parameters to read info out of
the shape file. Now come the big design questions

1) I have considered building a map object, basically a list that would
hold the info from the shape file and a data frame as part of the list.
Should all of the vertices of a shape be stored in this structure? I can
see this getting big really fast. My idea was to store only offset and the
size of each record and whenever a shape needs to be plotted or accessed 
the vertices can be retrived from the .shp file through an access function.
the problem is if the user wants to project the map all projections will
have to be done on the fly as the vertices are accessed. 

for those who don't know shape files are stored in 3 files, .shp .shx and .dbf
the .shp file holds the geometric information, the .shx file holds the
ofsets and the record sizes for each shape, and the .dbf file holds the
attribute information.

which brings me to question 2

2) the .dbf file contains the attribute information, so I
basically nead to write another version of read.table to access the dbf
file and store it as a data frame (the natural equivalent of an ArcView
data table). Is there a way to extend or access the functions of read.table
to construct a data frame without using a lot of memory building seperate
vectors and factors etc. and binding them into a data frame.

3) I have been cheating. Dr. Ripley suggested I start compiling this as
a package, using the supplied make files. Very sensible advice, however I am 
not exactly sure how to do this on windows. I have checked the faq which
says there is a sample Makefile in the eda package, I assume this
is Unix only couldn't find it. So to do this as far as I can tell from the
dcumentation I could get my hands on I need to make a folder in 
\rw0642\src\library and put the subdirectories R, src, man and data and
then run make? Or am I missing something?
 

Thanks again for all the help.

Nicholas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


ESRI shapes --again
Nicholas Lewin-Koh