Learn R Programming

SkyWatchr (version 0.8-2)

getPolygon: Get the boundary box for a given dataset retrieved in a query

Description

getPolygon creates an SpatialPolygonsDataFrame object that displays the boundary box for a given dataset based on info from the *area* column in the data.frame generated by querySW.

Usage

getPolygon(x, index)

Arguments

x

data.frame returned by the querySW function

index

numeric; index (row) of a record in x. See Details section

Value

a SpatialPolygonsDataFrame object

Details

getPolygon creates an SpatialPolygonsDataFrame object that displays the boundary box for a given dataset (corresponding to row index) based on info from the *area* column in the data.frame generated by querySW.

Examples

Run this code

api_key <- "your_personal_alphanumeric_api_key"

# Set the SkyWatchr.apikey option 
options(SkyWatchr.apikey = api_key)

res <- querySW(time_period = "2015-8", longitude_latitude = "-71.1043443,-42.3150676")
sppolygon <- getPolygon(res, 61)

library(mapview)
mapView(sppolygon)

Run the code above in your browser using DataLab