rgdal: Bindings for the Geospatial Data Abstraction Library
地形・地質マッピング
- CRAN: http://cran.r-project.org/web/packages/rgdal/index.html
- URL: http://www.gdal.org, https://r-forge.r-project.org/projects/rgdal/
> library(rgdal)
rgdal: version: 1.0-4, (SVN revision 548)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/proj
Linking to sp version: 1.1-1
> data("state")
バージョン: 1.0.4
関数名 | 概略 |
---|---|
CRS-class |
Class "CRS" of coordinate reference system arguments |
GDALDataset-class |
Class "GDALDataset" |
GDALDriver-class |
Class "GDALDriver": GDAL Driver Object |
GDALMajorObject-class |
Class "GDALMajorObject" |
GDALRasterBand-class |
Class "GDALRasterBand" |
GDALReadOnlyDataset-class |
Class "GDALReadOnlyDataset" |
GDALReadOnlyDataset-methods |
subset methods for "GDALReadOnlyDataset" |
GDALTransientDataset-class |
Class "GDALTransientDataset" |
GDALcall |
Wrapper functions to allow more direct calling of rgdal C code |
RGB2PCT |
Convert RGB three band to single band colour table |
SGDF2PCT |
Convert RGB three band to single band colour table |
SpatialGDAL-class |
Class "SpatialGDAL" |
closeDataset-methods |
closeDataset methods |
displayDataset |
Display a GDAL dataset |
llgridlines |
Plot long-lat grid over projected data |
make_EPSG |
Make a data frame of EPSG projection codes |
nor2k |
Norwegian peaks over 2000m |
projInfo |
List PROJ.4 tag information |
project |
Projection of coordinate matrices |
readGDAL |
Read/write between GDAL grid maps and Spatial objects |
readOGR |
Read OGR vector maps into Spatial objects |
showWKT |
Show Well-Known Text spatial reference system metadata |
spTransform-methods |
Methods for Function spTransform for map projection and datum transformation in package "rgdal" |
writeOGR |
Write spatial vector data using OGR |
readOGR
Arguments
- dsn... data source name
- layer
- verbose
- p4s
- stringsAsFactors
- drop_unsupported_fields
- input_field_name_encoding
- pointDropZ
- dropNULLGeometries
- useC
- disambiguateFIDs
- addCommentsToPolygons
- encoding
- use_iconv
- swapAxisOrder
- require_geomType
- integer64
- x
- ...
> system.file("vectors/Up.tab", package = "rgdal") %>% {
+ ogrInfo(dsn = ., layer = "Up")
+ readOGR(dsn = ., layer = "Up") %>% {
+ summary(.) %>% print()
+ plot(.)
+ }
+ }
> jp.map <- readOGR(dsn = "https://gist.github.com/uribo/b09d642351c03dd975aa/raw/6cd2f7e70922b24f89b442c96c001dc3ab794317/japan_one_twenty_map.topojson",
+ layer = "OGRGeoJSON",
+ stringsAsFactors = FALSE)
spTransform
> states <- data.frame(state.x77, state.center) %$% .[x > -121,]
> coordinates(states) <- c("x", "y")
> proj4string(states) <- CRS("+proj=longlat +ellps=clrk66")
> summary(states)
Length Class Mode
48 SpatialPointsDataFrame S4
> # plot(states)
> map.data <- geocode(c("Tokyo, Japan", "Osaka, Japan", "Sapporo, Japan"),
+ source = "google")
> map.data$name <- c("Tokyo", "Osaka", "Sapproro")
> jp.map %<>% fortify()
> jp.map.plot <- ggplot() +
+ geom_map(data = jp.map,
+ map = jp.map,
+ aes(x = long, y = lat, group = group, map_id = id),
+ fill = "white",
+ color = "black",
+ size = 0.2) +
+ coord_map() +
+ theme_minimal()
> jp.map.plot +
+ geom_point(data = map.data, aes(x = lon, y = lat),
+ color = "red", size = 3) +
+ geom_text(data = map.data, aes(x = lon, y = lat, label = name),
+ vjust = -1)