importShapefile {PBSmapping}R Documentation

Import an ESRI Shapefile

Description

Import an ESRI shapefile (.shp) into either a PolySet or EventData.

Usage

importShapefile (fn, readDBF = TRUE, projection = NULL, zone = NULL)

Arguments

fn

file name of the shapefile to import; specifying the extension is optional.

readDBF

Boolean value; if TRUE, it also imports the .dbf (a database containing the feature attributes) associated with the shapefile.

projection

optional projection attribute to override the internally derived value.

zone

optional zone attribute to override the default value of NULL.

Details

This routine imports an ESRI shapefile (.shp) into either a PolySet or EventData, depending on the type of shapefile. It supports types 1 (Point), 3 (PolyLine), and 5 (Polygon) and imports type 1 into EventData and types 3 and 5 into a PolySet. In addition to the shapefile (.shp), it requires the related index file (.shx).

If a database containing feature attributes (.dbf) exists, it also imports this database by default. For EventData, it binds the database columns to the EventData object. For a PolySet, it saves the database in a PolyData object and attaches that object to the PolySet in an attribute named “PolyData”.

If a .prj file exists, this information is attached as an attribute. If the first 3 characters are ‘GEO’, then a geographic projection is assumed and projection="LL". If the first 4 characters are ‘PROJ’, and ‘UTM’ occurs elsewhere in the string, then the Universal Transverse Mercator projection is assumed and projection="UTM". Otherwise, projection=1.

If an .xml file exists, this information is attached as an attribute.

Value

For points, EventData with columns EID, X, and Y, possibly with other columns from the attribute database. For polylines and polygons, a PolySet with columns PID, SID, POS, X, Y and attribute projection. Other attributes that may or may not be attached: parent.child (boolean vector from original input), shpType (numeric shape type: 1, 3, or 5), prj (projection information from .prj file, xml (metadata from an .xml file), PolyData (data from the attribute database .dbf), and zone (UTM zone).

See Also

importGSHHS, importEvents, importLocs, importPolys


[Package PBSmapping version 2.61.9 Index]