geoshapes | R Documentation |
Geoshapes objects contain one or more shapes (that is, polygons, points, or polylines) defined by their longitude and latitude in decimal degrees. These objects can be read or write to ERSI shape files.
geoshapes(x, name = "1", dbf = NULL)
read.geoshapes(shpFile, dbf = TRUE)
write.geoshapes(x, file, type = c("polygon", "point", "polyLine"),
dbf = TRUE, arcgis = FALSE,...)
## S3 method for class 'geoshapes'
print(x, ...)
## S3 method for class 'geoshapes'
lines(x, which = 1, ...)
## S3 method for class 'geoshapes'
points(x, which = "all", ...)
x |
A data frame with columns 'x' and 'y' for longitudes and latitudes of
the points in decimal degrees, or a list of such data frames for
|
name |
The name to use for the shape in case a data frame is passed to
|
dbf |
A data frame to record as 'dbf' attribute for |
shpFile |
The path to a .shp file (ESRI shape file) to import |
file |
The path to an ESRI file where to write data, without extension. Three files are created, with respective extensions .shp, .shx, and .dbf |
type |
The type of shape to write in the ESRI shape file |
arcgis |
If |
which |
The index of the shape to use, or its name |
... |
Further arguments passed to the functions (not used yet) |
geoshapes()
converts a data frame or a list into a 'geoshapes' object.
read.geoshapes()
and write.geoshapes()
read and write shapes
from or to ESRI shape files on disk.
The 'geoshapes' objects have methods to print them (very concisely), and to
add them to graphs, as polygons lines()
, or as separate points
points()
.
A 'geoshapes' object is returned from geoshapes()
and
read.geoshapes()
. The other functions are used for their side-effect
rather than for returning something useful.
Philippe Grosjean <phgrosjean@sciviews.org>
geomat
, geopoints
data(mbord) # Morocco borders
mbord
# Plot of Morocco terrain and add the borders in red
data(morocco)
image(morocco)
lines(mbord, col = 2)
# Simulate the creation of a geoshapes object with two shapes
geoshapes(list(a = mbord[[1]], b = mbord[[1]]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.