spatialEco (version 1.3-2)

daymet.tiles: DAYMET Tile ID's

Description

Returns a vector of DAYMET tile id's within a specified extent

Usage

daymet.tiles(x, tiles, ids, coords, sp = FALSE)

Arguments

x

A sp, raster or extent object (with same projection as tiles)

tiles

A SpatialPolygonsDataFrame tile index (see notes)

ids

A tile id field in the tiles index

coords

A vector of xmin, xmax, ymin, ymax coordinates, in same projection as tiles

sp

(TRUE/FALSE) Should an sp class SpatialPolygonsDataFrame object of associate tiles be returned

Value

Vector of DAYMET tile IDS or if sp = TRUE a sp class SpatialPolygonsDataFrame

Examples

Run this code
# NOT RUN {
library(sp)
library(raster)
data(DAYMET_tiles)
e <- extent(-117.2567, -104.7523, 36.62797, 47.68194) 
  plot(DAYMET_tiles)
    plot(e, col="red", add=TRUE)

# Using extent object	
daymet.tiles(x = e, tiles = DAYMET_tiles, ids = "Id")

# Using sp object
e <- as(e, "SpatialPolygons")	
daymet.tiles(e, tiles = DAYMET_tiles, ids = "Id")

# Using bounding coordinates	
daymet.tiles(coords=c(-117.2567, -104.7523, 36.62797, 47.68194),
             tiles = DAYMET_tiles, ids = "Id" )

# Return sp polygons object
tiles <- daymet.tiles(x = e, tiles = DAYMET_tiles, ids = "Id", sp = TRUE)
  plot(DAYMET_tiles)
    plot(tiles, col="red", add=TRUE)
			 
# }

Run the code above in your browser using DataCamp Workspace