#'
#' ### Issues
#'
#' * Multipart Polygons
#' * Holes
#'
#' Rarely construct _by hand_...
#'
#' # Importing data
#'
#' But, you rarely construct data _from scratch_ like we did above. Usually you will import datasets created elsewhere.
#'
#' ## Geospatial Data Abstraction Library ([GDAL](gdal.org))
#'
#' `rgdal` package for importing/exporting/manipulating spatial data:
#'
#' * `readOGR()` and `writeOGR()`: Vector data
#' * `readGDAL()` and `writeGDAL()`: Raster data
#'
#' Also the `gdalUtils` package for reprojecting, transforming, reclassifying, etc.
#'
#' List the file formats that your installation of rgdal can read/write with `ogrDrivers()`:
## ---- echo=F-------------------------------------------------------------
knitr::kable(ogrDrivers())
#'
#' Now as an example, let's read in a shapefile that's included in the `maptools` package. You can try
## ------------------------------------------------------------------------
## get the file path to the files
file=system.file("shapes/sids.shp", package="maptools")
## get information before importing the data
ogrInfo(dsn=file, layer="sids")
## Import the data
sids <- readOGR(dsn=file, layer="sids")
summary(sids)
plot(sids)
#'
#'
#' ### Maptools package
#' The `maptools` package has an alternative function for importing shapefiles that can be a little easier to use (but has fewer options).
#'
#' * `readShapeSpatial`
#'
## ------------------------------------------------------------------------
sids <- readShapeSpatial(file)
#'
#' ### Raster data
#'
#' We'll deal with raster data in the next section.
#'
#' # Coordinate Systems
#'
#' * Earth isn't flat
#' * But small parts of it are close enough
#' * Many coordinate systems exist
#' * Anything `Spatial*` (or `raster*`) can have one
#'
#' ## Specifying the coordinate system
#'
#' ### The [Proj.4](https://trac.osgeo.org/proj/) library
#' Library for performing conversions between cartographic projections.
#'
#' See [http://spatialreference.org](http://spatialreference.org) for information on specifying projections. For example,
#'
#'
#' #### Specifying coordinate systems
#'
#' **WGS 84**:
#'
#' * proj4: