kml_to_sp | R Documentation |
Create an sp SpatialPolygon or SpatialPolygonDataFrame object from a downloaded KML file and data file
kml_to_sp(map_df, df = NULL, crs_string = "+proj=longlat +datum=WGS84")
map_df |
a map dataframe generated from create_map_df() |
df |
a climate dataframe with one piece of data to be mapped to each unique spatial polygon. |
crs_string |
Coordinate reference string to use in spatial projection. Default is WSGS84. |
If a dataframe is included, a spatial polygon dataframe object is created. The dataframe must have one unique piece of information per polygon, otherwise an error will be thrown. However just a basic spatial polygon will be created if no dataframe is included.
a SpatialPolygon object
## Not run:
sa_map <- create_map_df(locator=SoAm_country)
sa_dat <- get_ensemble_temp(SoAm_country,"annualanom",2080,2100)
sa_dat <- subset(sa_dat,sa_dat$scenario == "a2")
sa_dat <- subset(sa_dat,sa_dat$percentile == 50)
sa_poly <- kml_to_sp(sa_map,df = sa_dat)
### colors are a bit off, but just to verify that data is
spplot(sa_poly,"data")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.