coordinates {sp} | R Documentation

## sets spatial coordinates to create spatial data, or retrieves spatial coordinates

### Description

sets spatial coordinates to create spatial data, or retrieves spatial coordinates

### Usage

            coordinates(obj)
            coordinates(object) <- value

### Arguments

`obj` | object deriving from class "Spatial"
`object` | object of class "data.frame"
`value` | spatial coordinates; either a matrix, list, or data frame with numeric data, or column names, column number or a reference: a formula (in the form of e.g. `~x+y`), column numbers (e.g. `c(1,2)`) or column names (e.g. `c("x","y")`) specifying which columns in `object` are the spatial coordinates. If the coordinates are part of object, giving the reference does not duplicate them, giving their value does duplicate them in the resulting structure.

### Value

an object of class SpatialPointsDataFrame

### Examples

    # data.frame
    data(meuse.grid)
    coordinates(meuse.grid) <- ~x+y
    gridded(meuse.grid) <- TRUE
    bbox(meuse.grid)

[Package sp version 0.7-12 Index]