/RArcInfo

Repository for the RArcInfo R package.

Primary LanguageC

 RArcInfo - 0.4-6

- INTRODUCTION

 This package enables R to import data from Arc/Info  V7.x binary
coverages. It uses the wonderful functions written by 
Daniel Morissette <damno@videotron.ca> to import/export data
from binary coverages from/to E00 ASCII files.
Please, notice that all the code under the RArcInfo/src/avce00 is
copyright of Daniel Morissette, who is the original writter.
I didn't write any code inside this directory.

Since all the code must be in the RArcInfo/src directory (and Windo$s doesn't allow
symbolic links), I have copied some files from RArcInfo/src/avce00 to it. 
The only files I have written are RArcInfo.c and RArcInfo.h. All the other ones 
are copyrighted by Daniel Morissette.

- THE CODE

 Basically, there is a function to import each type of file (ARC, LAB, etc.) in the
coverage directory.
Please, notice that RArcInfo is a work in progress.

 Nowadays, the list of functions RArcInfo provides is:

-get.namesofcoverages(dir)

  Provided the name of the directory where the coverage (dir) is,  it returns
the names of all the coverages... Well, it really returns all the file and directory
names in the directory 'dir'.

- get.tablenames(dir)
  
  Returns all the table names plus some aditional data, like the number of 
records. More information about this can be found in the help. 

- get.tablefields(infodir, tablename)

 Returns the name of the fields of the given table.

- get.XXXdata(datadir, coverage, filename)

  Returns the data of the given filename into a R list. XXX can be:

   arc, pal, lab, cnt, tol, txt

- get.bnddata (infodir, tablename)

 Returns the boundary coordinates of the geographical data.

- get.tabledata(infodir, coverage, tablename)


There also also another two functions to plot arcs:

- plotarc(arc, new=T)

 This plot all the arcs returned by get.arcdata. If we want
to rebuild the limits in the axis we should set new=T. In other case 
we should set new=F. This is useful when you want to draw some coverages.

- plotpal(arc, pal, new=T)

 Now we only plot the arcs defined by pal (returned from a call to 
get.pladata).




* EXAMPLE

Let us suppose we have all the data (in format Arc/Info V7.x) under the directory
/usr/gis/data. We'll have a directory called "info", where some files with information
about all the coverages is stored. We have two coverages called "Lakes" and "Rivers"
under the directories "lakes" and "rivers".

/usr/gis/data--/
               |
	       |
	    |-----|------|
	   info  lakes rivers

To import the arcs from the lakes coverage we can write and store them in a variable
called arclakes, we can write:

arclakes<-get.arcdata("/usr/gis/data/","lakes","arc.adf")

Notice the final slash in the first argument and the name of the file where the data
are stored. This is the more common name, but it may change.

To import the polygons  we write:

pallakes<-get.paldata("/usr/gis/data/","lakes","pal.adf")

To plot all the lakes:

plotpal(arclakes, pallakes)


You can find another example under the directory "tests" in the source package.


* TODO

- Improve the documentation quality.
- Improve the plot functions
- Write functions to perform searches in tables.
- In get.toldata the default filename is "tol.adf", which is the one for single
	precision coverages. For double precision coverages it should be "par.adf".

Please, I would like to hear suggestions from the users in order to improve this package.


EXAMPLE DATA

The data under the directory "RArcInfo/exampleData" has been downloaded from
the web of the UNEP/GIRD-Arendal (http://www.grida.no/baltic/index.htm). I would
like to thank Hugo Ahlenius and Sindre Langaas for their help and soon answers.

This site also provides more data about the Baltic Sea Region and the
countries around it. I only took the data from wetlands because of its small
size, but there are many more data available to download for free there.

Another example based on the province of Valencia (Spain) has been added.
The Rate of Unemployment in 1991 for each municipality has been plooted.
Data have been obtained from 'Instituto Valenciano de Estadistica' (several
statistics) and  'Oficina del Catastro' (E00 file, which was generated by
means of R/Shapelib/GRASS from a SVG file).


ABOUT RARCINFO AND ARC/VIEW

Some people have written to me asking whether this package is able to import/export
data from/to Arc/View in the same way that the extension for the S-Plus does. 
The answer is no, but I think it can be done using the R-(D)COM server and
writting the code for this (of course ;-) ).

I know ArcView supports, from version 8.1, VB scripts, so it should be easy
to write some connection between R and ArcView...



RARCINFO AT SOURCEFORGE

I have opened a project at www.sourceforge.net in order to keep there all
the source code. When I have more spare time I will make a beatiful web page too...

NEWS

*V 0.4-4
	- xratio and yratio have been added to plotpoly to control width
	and height of the plot.
	- plotpoly have been improved to properly set the plotting
	region, etc.
	- Makefile has been deleted and a 'PKG_CFLAGS = -fno-strict-aliasing'
	has been added to Makevars. This fixes the way numbers are converted
	to little endian format in avcelib.

*V 0.4-3
	- RArcInfo started to fail when compiling using gcc 3.x due to
	the -O3 flag. Two files called Makevars and Makefile have been
	added in order to compile thepackage with flag -O.

*V 0.4-2
	- 'index' argument added to plotarc to select the arcs to plot.
	- 'index' argument added to plotpal to select the polygons to plot.
	- New function 'get.nb', which, given a set of polygons, returns
	the neighbouring polygons of each one.
	- Fixed a bug in 'get_tol_data'. The file to be open was of
	type CNT instead of TOL. Now tolerances are read without problems.
	- Output messages have been changed in several functions to
	be more useful for the user.
	- Fixed a bug in 'plotarc' when calculating plot dimensions.
	- Example added to RArcInfo documentation file.

*V 0.4-1- 'thinlines' modified to keep the last point of the arcs. Thanks
	to Erich Neuwirth for this comment.

*V 0.4	- Two new functions added to convert from/to ArcInfo binary
	coverages to/from E00 files: 'e00toavc' and 'avctoe00'.
	- 'read.coverage' now reads the polygon definiton file is
	there exists just one file for that inside the coverage.
	- New function 'thinlines', which reduces the number of
	points in the arc definition object (returned by get.arcdata).
	Using the thinned 'arc object' will speed up R when plotting.

*V 0.3
	- The argument '...' has been added to all the plotting functoins
	in order to allow the user more control over the maps.
	- The plots are scaled according to the real proportions of
	the map.
	- Added a configure script in order to proper compile under several
	platforms. UPDATE: No longer needed because endianness is tested
	and set in the C sources.
	- Added the function read.coverage to retrieve whole informtation
	- Fixed a bug in plotpoly. If the first polygon Id is 0, then
	the function wasn't able to draw a map due to the lack of
	x,y coordinates.
	- Single and double precision data are correctly imported now. I have
	changed the way precision is tested.
* V 0.2-1
	- Some bug fixes related reading double and single precision data.
* V 0.2
	- Added a new function to plot polygons (plotpoly).
	- get.tabledata labels the columns using get.tablefields.
	- Added a function to import TXT data (get_txt_data).
	- Fixed a bug in the documentation. "infodir" has been changed to
	 "datadir" in most functions.
	- Added a new manual page about the whole package. Try 'help(RArcInfo)'.

* V 0.1
	- Function get.bnddata now works properly.
	- The data returned by the functions get.XXXdata (XXX=arc, pal, cnt) have been
	changed to a data frame (a table with some fields of the data and named columns) and 
	a list (that stores de coordinates of the points, etc.). 
	- Besides, the data returned by the functions get.tablenames, get.tablefields, 
	get.tabledata, get.XXXdata (XXX=lab, tol) has changed too. Now they are
	data frames with named columns.
	- get.namesofcoverages now returns only the names of the directories where
	the data are stored.
	- The links to Daniel's code has been deleted and I have copied the files
	into the src directory in order to be able to compile the package for
	Windows.

* V 0.03
	- Added some example data and a test.
	- Added some defaults values for the variable "filename" in some get.XXXdata functions.
	- Fixed some minor bugs.
	- Keywords added.

THANKS

I would like to thank these people their comments and help:

-Daniel Morissette, for writing avcelib.

-Erich Neuwirth, for his comments and providing me with more data to test the
package.

-Hannes Reuter and Robert Denham, for their comments and testing the package on
sun machines.

- All the people in the several R mailing lists, for their valuable comments.

- The R Core Team, for giving us R.


Enjoy!

 Virgilio Gómez Rubio


P.S:

 If you find this package useful, please, feel free to make suggestions to improve it
and to send (nice) postcards to:

  Virgilio Gómez Rubio
  Dpto. Estadística e I.O.
  Facultad de Matemáticas
  Avda. Vicent A. Estellés, 1
  46100 Burjassot (València)
  Spain