gmt: Interface between GMT Map-Making Software and R

> library(gmt)

Attaching package: 'gmt'
The following object is masked from 'package:sna':

    geodist

バージョン: 1.2.0


関数名 概略
deg2num Convert Degrees to Numeric
geodist Distance Between Geographic Coordinates
gmt Initialize GMT Session
gmt-package Interface between the GMT Map-Making Software and R
gmt.demo GMT Example Data
gmt.system Invoke shell command
num2deg Convert Numeric to Degrees
psbar Add Bars to GMT Mercator Map
psclose Finalize GMT Map
pscoast Draw GMT Map
pstext Add Text/Symbols to GMT Map
psxy Add Lines/Symbols to GMT Map
r2gmt Prepare Data for GMT

deg2num

> c("12:30:44.5W", "17.5S", "1:00:05", "200:45E") %>% deg2num()
12:30:44.5W       17.5S     1:00:05     200:45E 
 -12.512361  -17.500000    1.001389  200.750000

geodist

座標をもとに距離を求める

Arguments

  • Nfrom
  • Efrom
  • Nto
  • Eto
  • units
> geodist(Nfrom = 55.75, Efrom = 37.63, 
+         Nto = 39.9, Eto = 116.4)
[1] 5789.225
> geodist(90,0, -90,0, units = "km")
[1] 20001.6

gmt

> gmt(demo.par)
> pscoast(demo.coast)
> psxy(demo.xy)
> pstext(demo.text)
> psbar(demo.bar, ref=66)
> psclose()

gmt.demo

> demo.par
[1] "DEGREE_SYMBOL degree PAGE_ORIENTATION PAPER_MEDIA a4+ portrait PLOT_DEGREE_FORMAT F"
> demo.coast
[1] "-JM16c -R30W/15E/54N/70N -Di -G100/200/100 -B10f5g5/4f2g2 -K"
> demo.xy
     Lon   Lat Size
1 -29:00 56:30    3
2 -27:30 57:00    6
3 -26:00 57:30    9
> demo.text
     Lon    Lat Size Angle Font Justify            Text
1 22:30W 57:00N   12    33   21      CM           Label
2 17:30W 57:00N   24     0   29      CM       @~p@~r@+2
3 27:30W 59:00N   24    90   34      CM           \\342
4 22:30W 59:00N   16     0   34      CM \\302\\314\\112
5 17:30W 59:00N   16     0   34      CT      \\335\\336
6 17:30W 59:00N   16     0   34      CB      \\341\\053
> demo.bar
    Lon Lat Width Height
1 -12.5  58   0.5      2
2 -12.5  62   0.5      2
3 -12.5  66   0.5      2

num2deg

Arguments

  • x
  • lat
  • dec
  • digits
  • zero
> num2deg(c(-12.51236, -17.5, 1.00139, 200.75),
+         lat = c(FALSE, TRUE,  NA,      FALSE),
+         dec = c(FALSE, TRUE,  FALSE,   FALSE),
+         digits = c(1,  1,     0,       0))
[1] "12:30:44.5W" "17.5S"       "1:00:05"     "200:45E"