geosphere: Spherical Trigonometry

> library(geosphere)

バージョン: 1.5.5


関数名 概略
alongTrackDistance Along Track Distance
antipode Antipodes
areaPolygon Area of a longitude/latitude polygon
bearing Direction of travel
bearingRhumb Rhumbline direction
centroid Centroid of spherical polygons
daylength Daylength
destPoint Destination given bearing (direction) and distance
destPointRhumb Destination along a rhumb line
dist2Line Distance between points and lines or the border of polygons.
dist2gc Cross Track Distance
distCosine 'Law of cosines' great circle distance
distGeo Distance on an ellipsoid (the geodesic)
distHaversine 'Haversine' great circle distance
distMeeus 'Meeus' great circle distance
distRhumb Distance along a rhumb line
distVincentyEllipsoid 'Vincenty' (ellipsoid) great circle distance
distVincentySphere 'Vincenty' (sphere) great circle distance
distm Distance matrix
finalBearing Final direction
gcIntermediate Intermediate points on a great circle (sphere)
gcIntersect Intersections of two great circles
gcIntersectBearing Intersections of two great circles
gcLat Latitude on a Great Circle
gcLon Longitude on a Great Circle
gcMaxLat Highest latitude on a great circle
geodesic geodesic and inverse geodesic problem
geomean Mean location of sperhical coordinates
geosphere-package Geosphere
greatCircle Great circle
greatCircleBearing Great circle
horizon Distance to the horizon
makePoly Add vertices to a polygon or line
mercator Mercator projection
midPoint Mid-point
onGreatCircle Is a point on a given great circle?
perimeter Compute the perimeter of a longitude/latitude polygon
plotArrows Plot
randomCoordinates Random or regularly distributed coordinates on the globe
refEllipsoids Reference ellipsoids
span Span of polygons
wrld World countries

alongTrackDistance

> alongTrackDistance(c(0,0),c(60,60),c(50,40))
     distance
[1,]  6627576

alongTrackDistance

Arguments

  • p1, p2, p3
  • r
> alongTrackDistance(c(0,0), c(60,60), c(50,40))
     distance
[1,]  6627576

antipode

対蹠地

Arguments

  • p
  • p1
  • p2
  • tol
> antipodal(c(0, 0), c(180, 0))
[1] TRUE
> antipodal(c(0, 0), c(179, 0), tol = 1e-9)
[1] FALSE

centroid

> rbind(c(-180,-20), c(-160,5), c(-60, 0), c(-160,-60), c(-180,-20)) %>% centroid()
           lon      lat
[1,] -133.3333 -23.8934

distCosine

> distCosine(c(0,0), c(90,90))
[1] 10018754

dist2Line

> line <- rbind(c(-180,-20), c(-150,-10), c(-140,55), c(10, 0), c(-140,-60))
> pnts <- rbind(c(-170,0), c(-75,0), c(-70,-10), c(-80,20), c(-100,-50), c(-100,-60), c(-100,-40), c(-100,-20), c(-100,-10), c(-100,0))
> dist2Line(pnts, line)
      distance        lon        lat
 [1,]  1822666 -164.62592 -15.502630
 [2,]  7800515  -41.28026  65.943660
 [3,]  6915308  -25.26047 -63.543299
 [4,]  5644656  -80.21477  70.776119
 [5,]  2408555 -121.39866 -68.985526
 [6,]  1363414 -112.84043 -71.076859
 [7,]  3443074 -129.21258 -66.185200
 [8,]  5454129 -140.00000 -60.000000
 [9,]  5472559 -149.78325  -8.048172
[10,]  5402940 -148.13635   7.071146

distGeo

> distGeo(c(0,0), c(90,90))
[1] 10001966

distMeeus

> distMeeus(c(0,0), c(90,90))
[1] 10001959

makePoly

randomCoordinates

> randomCoordinates(2)
           lon         lat
[1,] 139.64725 -44.0197534
[2,]  88.72164   0.2833555
> # regularCoordinates(4)

refEllipsoids

> ellips <- refEllipsoids()
> length(ellips)
[1] 4
> head(ellips)
                             ellipsoid code     invf       a
1                          Airy (1930)   AA 299.3250 6377563
2                  Australian National   AN 298.2500 6378160
3                          Bessel 1841   ?? 299.1528 6377397
4 Ethiopia,  Indonesia,  Japan,  Korea   BR 299.1528 6377397
5                              Namibia   BN 299.1528 6377484
6                          Clarke 1866   CC 294.9787 6378206

wrld

> data("wrld")
> wrld %>% head()
     Longitude Latitude
[1,] -61.68667 17.02444
[2,] -61.88722 17.10527
[3,] -61.79445 17.16333
[4,] -61.68667 17.02444
[5,]        NA       NA
[6,] -61.72917 17.60861