时空K函数

时间:2014-03-17 15:12:13

标签: r geospatial

我有一个包含3列的示例数据文件; x,y和日期。请参阅以下可重现的示例:

    sample<-structure(list(x = c(14216915.57, 14208448.89, 14919650.31, 14733383.27, 
    15326051.13, 15867918.88, 15486918.11, 15376851.23, 14885783.58, 
    14623316.39, 14174582.16, 14894250.26, 14580982.97, 14479382.77, 
    14724916.59, 14919650.31, 14919650.31, 15004317.15, 15080517.3, 
    15002553.26, 15002553.26, 15047532.51, 15080517.3, 15039595, 
    14970803.19, 15039595, 15047532.51, 15103095.12, 15021074.13, 
    14952282.32, 14920532.26, 14920532.26, 15140136.86, 15129553.51, 
    14793532, 14658594.23, 14438989.63, 14626844.17, 14584510.75, 
    14362260.31, 15740742.23, 15086690.92, 15060444.21, 15043510.84, 
    15050284.18, 14773423.63, 14992710.74, 15196757.81, 15054517.53, 
    14927517.27, 14833537.08, 14996097.41, 14977470.71, 14825070.4, 
    15284811.32, 15289891.33, 15131564.35, 15150191.05, 15113784.31, 
    15170511.09, 15113784.31, 15075684.24, 15059597.54, 14704843.49, 
    14825917.07, 14892803.87, 15026577.47, 14869943.82, 14889417.2, 
    14705690.16, 14611709.97, 14550749.85, 14525349.8, 14718390.19, 
    14894497.21, 15050284.18, 14995250.74, 14915663.92, 14946143.98, 
    14913123.91, 14879257.18, 14813217.04, 14874177.17, 14722623.53, 
    15099390.95, 15047744.18, 15123097.66, 15177284.44, 15109550.97, 
    14985937.39), y = c(-3109317.436, -3456451.463, -3117784.119, 
    -2770650.092, -3634251.819, -3295584.475, -2677516.572, -3295584.475, 
    -3541118.299, -3210917.639, -2660583.205, -2872250.295, -2855316.928, 
    -3507251.565, -3388717.994, -3354851.26, -3117784.119, -3117784.119, 
    -3202450.955, -3217267.651, -3217267.651, -3254309.392, -3202450.955, 
    -3164350.879, -3174934.233, -3164350.879, -3254309.392, -3304580.326, 
    -3323101.196, -3283413.617, -3214621.813, -3214621.813, -3235788.522, 
    -3164350.879, -3267538.585, -3032058.948, -3283413.617, -3558580.834, 
    -3391893.001, -3346913.744, -3614143.445, -3275952.352, -3325059.117, 
    -3373319.214, -3299659.066, -3476612.753, -3722993.246, -3594299.656, 
    -3507939.483, -3448672.698, -3327599.122, -3292885.719, -3254785.643, 
    -3201445.536, -3382632.566, -3283572.367, -3458832.718, -3380939.229, 
    -3353845.841, -3266639, -3267485.669, -3250552.301, -3278492.357, 
    -3344532.489, -3423272.647, -3391099.249, -3301352.403, -3248858.965, 
    -3336912.474, -3275952.352, -3292885.719, -3246318.96, -3359772.52, 
    -3488466.111, -3476612.753, -3440206.014, -3391099.249, -3298812.398, 
    -3242085.618, -3275105.684, -3291192.383, -3226845.587, -3217532.235, 
    -3226845.587, -3226845.587, -3209065.552, -3201445.536, -3332679.132, 
    -3607846.349, -3606153.013), Date = structure(c(1L, 8L, 10L, 
    14L, 1L, 3L, 13L, 9L, 13L, 13L, 2L, 12L, 12L, 8L, 9L, 11L, 4L, 
    4L, 6L, 6L, 6L, 8L, 5L, 5L, 7L, 7L, 4L, 7L, 7L, 4L, 8L, 8L, 5L, 
    5L, 9L, 1L, 5L, 14L, 14L, 1L, 3L, 15L, 15L, 14L, 14L, 4L, 7L, 
    7L, 4L, 8L, 4L, 7L, 4L, 13L, 9L, 13L, 13L, 2L, 12L, 12L, 8L, 
    9L, 11L, 4L, 4L, 6L, 6L, 6L, 8L, 5L, 5L, 7L, 7L, 4L, 7L, 7L, 
    4L, 8L, 8L, 13L, 9L, 13L, 13L, 2L, 12L, 12L, 8L, 9L, 11L, 4L), .Label = c("01/2009", 
    "01/2010", "02/2009", "03/2009", "03/2010", "04/2009", "04/2010", 
    "05/2009", "06/2009", "06/2010", "07/2009", "07/2010", "08/2009", 
    "11/2009", "12/2010"), class = "factor")), .Names = c("x", "y", 
    "Date"), class = "data.frame", row.names = c(NA, -90L))

我正在尝试采用here找到的示例,但到目前为止还没有成功。

    require(shapefiles)
    require(maptools)
    require(maps)
    require(rgdal)
    require(zoo)
    require(lubridate)


    #run the sample object to create data frame
    spatialsample<-sample[,c("x","y")]
    coord<-SpatialPoints(spatialsample)
    coorddf <-  SpatialPointsDataFrame(coord, data = spatialsample)
    poly<-bboxx(sample)

    sample$Date <- mdy(as.character(sample$Date))
    sample$Date<-as.yearmon(sample$Date)

    tlim=c("Jan 2009","Dec 2010")
    s=seq(0,.3,len=3000)[-1]
    t=s
    stk = stkhat(sample[,1:2], sample[,3], poly, tlim, s,t)
    image(str$kst)
    image(x=stk$s, y=stk$t,z = stk$kst)

特别是我希望显示轮廓,其中x轴显示以米(或km)为单位的距离,y轴显示时滞。任何帮助将不胜感激。

0 个答案:

没有答案