write.grid: Export a grd object as csv or shapefile

Description Usage Arguments Value Author(s) See Also Examples

Description

Export a grd object (created by make.grid) as csv or shapefile.

Usage

1
write.grid(grd, file, type="csv")

Arguments

grd

a grid object created by the function make.grid.

file

character string naming the output filename. For csv files do include the extension (e.g. "my_file.csv"); for shapefiles omit the extension (e.g. "my_file").

type

character string specifying the output file type. Must be one of "csv" (default) or "shape"

Value

A csv file with three columns corresponing to x, y and z (lon, lat, value), or a shapefile with a polygon for each cell in the grd object. The assumed projection is EPSG:4326

Author(s)

Hans Gerritsen

See Also

make.grid, write.shapefile .

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(shapefiles)
data(landings)
data(coast)
byx = 1
byy = 0.5
xlim <- c(-15.5,0)
ylim <- c(50.25,56)
grd <- make.grid(landings$Lon, landings$Lat, landings$LiveWeight, byx, byy, xlim, ylim)
breaks <- breaks.grid(grd,zero=FALSE)
basemap(xlim, ylim, main = "Gadoid landings")
draw.grid(grd,breaks)
draw.shape(coast, col="darkgreen")
legend.grid("topright", breaks=breaks/1000, type=2)
## Not run: 
write.grid(grd,"c:/test1.csv")
write.grid(grd,"c:/test1","shape")

## End(Not run)

mapplots documentation built on May 2, 2019, 9:15 a.m.