sp: Classes and Methods for Spatial Data
空間データのクラスおよびメソッド
- CRAN: http://cran.r-project.org/web/packages/sp/index.html
- URL: https://r-forge.r-project.org/projects/rspatial/, http://rspatial.r-forge.r-project.org/
> library(sp)
バージョン: 1.2.3
関数名 | 概略 |
---|---|
CRS-class |
Class "CRS" of coordinate reference system arguments |
DMS-class |
Class "DMS" for degree, minute, decimal second values |
GridTopology-class |
Class "GridTopology" Line create objects of class Line or Lines |
Line-class |
Class "Line" |
Lines-class |
Class "Lines" |
Polygon-class |
Class "Polygon" |
Polygons-class |
Class "Polygons" |
Rlogo |
Rlogo jpeg image |
Spatial-class |
Class "Spatial" |
SpatialGrid-class |
Class "SpatialGrid" |
SpatialGridDataFrame-class |
Class "SpatialGridDataFrame" |
SpatialLines |
create objects of class SpatialLines or SpatialLinesDataFrame |
SpatialLines-class |
a class for spatial lines |
SpatialLinesDataFrame-class |
a class for spatial lines with attributes |
SpatialPixels |
define spatial grid |
SpatialPixels-class |
Class "SpatialPixels" |
SpatialPixelsDataFrame |
define spatial grid with attribute data |
SpatialPixelsDataFrame-class |
Class "SpatialPixelsDataFrame" |
SpatialPoints |
create objects of class SpatialPoints or SpatialPointsDataFrame |
SpatialPoints-class |
Class "SpatialPoints" |
SpatialPointsDataFrame-class |
Class "SpatialPointsDataFrame" |
SpatialPolygons |
create objects of class SpatialPolygons or SpatialPolygonsDataFrame |
SpatialPolygons-class |
Class "SpatialPolygons" |
SpatialPolygonsDataFrame-class |
Class "SpatialPolygonsDataFrame" |
addAttrToGeom-methods |
constructs SpatialXxxDataFrame from geometry and attributes |
aggregate |
aggregation of spatial objects |
as.SpatialPolygons.GridTopology |
Make SpatialPolygons object from GridTopology object |
as.SpatialPolygons.PolygonsList |
Making SpatialPolygons objects bbox,Spatial-method retrieve bbox from spatial data |
bpy.colors |
blue-pink-yellow color scheme, which also prints well on black/white printers |
bubble |
Create a bubble plot of spatial data |
char2dms |
Convert character vector to DMS-class object |
compassRose |
Display a compass rose. |
coordinates |
set spatial coordinates to create a Spatial object, or retrieve spatial coordinates from a Spatial object |
coordinates-methods |
retrieve (or set) spatial coordinates |
coordnames-methods |
retrieve or assign coordinate names for classes in sp |
degAxis |
axis with degrees |
dimensions,Spatial-method |
retrieve spatial dimensions from spatial data |
disaggregate-methods |
disaggregate SpatialLines, SpatialLinesDataFrame, SpatialPolygons, or SpatialPolygonsDataFrame objects |
flipHorizontal |
rearrange data in SpatialPointsDataFrame or SpatialGridDataFrame for plotting with spplot (levelplot/xyplot wrapper) |
geometry-methods |
Methods for retrieving the geometry from a composite (geometry + attributes) object |
gridIndex2nb |
create neighbourhood (nb) object from grid geometry |
gridded-methods |
specify spatial data as being gridded, or find out whether they are |
gridlines |
Create N-S and E-W grid lines over a geographic region |
image.SpatialGridDataFrame |
image gridded spatial data, or convert to format for image |
is.projected |
Sets or retrieves projection attributes on classes extending SpatialData |
loadMeuse |
deprecated function to load the Meuse data set |
mapasp |
Calculate aspect ratio for plotting geographic |
maps; |
create nice degree axis labels |
merge |
Merge a Spatial* object having attributes with a data.frame |
meuse |
Meuse river data set |
meuse.grid |
Prediction Grid for Meuse Data Set |
meuse.grid_ll |
Prediction Grid for Meuse Data Set, geographical coordinates |
meuse.riv |
River Meuse outline |
nowrapSpatialLines |
Split SpatialLines components at offset |
over-methods |
consistent spatial overlay for points, grids and polygons |
overlay |
Deprecated functions in sp |
panel.spplot |
panel and panel utility functions for spplot |
point.in.polygon |
do point(s) fall in a given polygon? |
polygons |
sets spatial coordinates to create spatial data, or retrieves spatial coordinates |
polygons-methods |
Retrieve polygons from SpatialPolygonsDataFrame object |
read.asciigrid |
read/write to/from (ESRI) asciigrid format |
recenter-methods |
Methods for Function recenter in Package 'sp' |
select.spatial |
select points spatially |
sp |
A package providing classes and methods for |
spatial |
data: points, lines, polygons and grids |
spChFIDs-methods |
change feature IDs in spatial objects |
spDistsN1 |
Euclidean or Great Circle distance between points |
spTransform |
spTransform for map projection and datum transformation |
spmap.to.lev |
rearrange data in SpatialPointsDataFrame or SpatialGridDataFrame for plotting with spplot (levelplot/xyplot wrapper) |
spplot |
Plot methods for spatial data with attributes |
spsample |
sample point locations in (or on) a spatial object |
surfaceArea |
Compute surface area of a digital elevation model. |
zerodist |
find point pairs with equal spatial coordinates |
SpatialPolygons
ポリゴンクラスオブジェクトの作成
char2dms / dd2dms
Arguments
- from
- chd
- chm
- chs
- dd
- NS
> data("state")
> state.center$y %>% {
+ print(str(.))
+ (stateN <<- dd2dms(., NS = TRUE))
+ }
num [1:50] 32.6 49.2 34.2 34.7 36.5 ...
NULL
[1] 32d35'24.36"N 49d15'N 34d13'9.12"N 34d44'0.96"N 36d32'2.76"N
[6] 38d40'39.72"N 41d35'34.08"N 38d40'39.72"N 27d52'27.84"N 32d19'58.44"N
[11] 31d45'N 43d33'53.28"N 40d2'58.2"N 40d2'58.2"N 41d56'8.88"N
[16] 38d25'13.44"N 37d23'29.4"N 30d37'5.16"N 45d37'21.36"N 39d16'40.08"N
[21] 42d21'52.2"N 43d8'9.96"N 46d23'39.48"N 32d40'32.88"N 38d20'4.92"N
[26] 46d49'22.8"N 41d20'8.16"N 39d6'22.68"N 43d23'36.24"N 39d57'49.32"N
[31] 34d28'35.04"N 43d8'9.96"N 35d25'10.2"N 47d15'6.12"N 40d13'15.6"N
[36] 35d30'19.08"N 43d54'28.08"N 40d54'24.84"N 41d35'34.08"N 33d37'8.4"N
[41] 44d20'11.4"N 35d40'36.12"N 31d23'22.92"N 39d6'22.68"N 44d15'2.88"N
[46] 37d33'46.8"N 47d25'23.16"N 38d25'13.44"N 44d35'37.32"N 43d3'1.44"N
> stateN %>% {
+ print(str(.))
+ ch.stateN <<- as.character(.)
+ }
Formal class 'DMS' [package "sp"] with 5 slots
..@ WS : logi [1:50] FALSE FALSE FALSE FALSE FALSE FALSE ...
..@ deg: int [1:50] 32 49 34 34 36 38 41 38 27 32 ...
..@ min: int [1:50] 35 15 13 44 32 40 35 40 52 19 ...
..@ sec: num [1:50] 24.36 0 9.12 0.96 2.76 ...
..@ NS : logi TRUE
NULL
> str(ch.stateN)
chr [1:50] "32d35'24.36\"N" "49d15'N" "34d13'9.12\"N" ...
> stateNa <- char2dms(ch.stateN)
> str(attributes(stateNa))
List of 6
$ WS : logi [1:50] FALSE FALSE FALSE FALSE FALSE FALSE ...
$ deg : int [1:50] 32 49 34 34 36 38 41 38 27 32 ...
$ min : int [1:50] 35 15 13 44 32 40 35 40 52 19 ...
$ sec : num [1:50] 24.36 0 9.12 0.96 2.76 ...
$ NS : logi TRUE
$ class: atomic [1:1] DMS
..- attr(*, "package")= chr "sp"
> ch.stateN <- as(stateN, "character")
> str(ch.stateN)
chr [1:50] "32d35'24.36\"N" "49d15'N" "34d13'9.12\"N" ...
> stateNa <- char2dms(ch.stateN)
> str(attributes(stateNa))
List of 6
$ WS : logi [1:50] FALSE FALSE FALSE FALSE FALSE FALSE ...
$ deg : int [1:50] 32 49 34 34 36 38 41 38 27 32 ...
$ min : int [1:50] 35 15 13 44 32 40 35 40 52 19 ...
$ sec : num [1:50] 24.36 0 9.12 0.96 2.76 ...
$ NS : logi TRUE
$ class: atomic [1:1] DMS
..- attr(*, "package")= chr "sp"
> char2dms(from = "24d28'06.0\"N") %>% as.numeric()
[1] 24.46833
> char2dms(from = "123d0'17.0\"E") %>% as.numeric()
[1] 123.0047