Hello,

I   tried   to  transform   a   style-image   list   into  an   object
SpatialGridDataFrame  but I  have  a problem  concerning the  function
image2grid. I have the following message:

Erreur dans image2Grid(im) : x or y not equally spaced

Have you a track I suggest?

Thank's


#### MY CODE

# Longitude(x) et latitude(y)
xy <- cbind(x=err$x, y=err$y)

> xy
               x        y
  [1,] -446529.3 694533.6
  [2,] -446579.9 693934.9
  [3,] -444977.1 694335.8
  [4,] -444683.5 695310.2
  [5,] -444632.7 695763.3
  [6,] -444507.0 695797.4
  [7,] -444419.4 695844.2
  [8,] -444130.2 696264.6
  [9,] -444215.2 696799.0
 [10,] -443785.3 699918.4
 [11,] -442931.7 701051.2
 [12,] -440677.3 702047.6
 [13,] -440216.3 701987.9
 [14,] -440096.9 702108.6
 [15,] -441193.4 702916.2
 [16,] -441323.3 702928.1
 [17,] -441380.8 702946.9
 [18,] -441761.5 702806.9
 [19,] -441676.4 702842.0
 [20,] -441601.0 702835.9
 [21,] -441599.9 702836.6
 [22,] -441365.2 702905.0
 [23,] -441372.4 702884.9
 [24,] -441366.6 702922.4
 [25,] -441155.2 702871.6
 [26,] -440538.3 702125.6
 [27,] -440195.4 701771.5
 [28,] -439753.7 701558.5
 [29,] -440218.5 701523.0
 [30,] -440489.4 701520.5
 [31,] -440557.8 701416.3
 [32,] -440611.0 701392.8
 [33,] -440502.4 700831.7
 [34,] -440457.9 700803.0
 [35,] -441242.7 701022.9
 [36,] -441829.7 701382.0
 [37,] -441950.6 701181.5
 [38,] -442003.4 701143.9
 [39,] -442158.1 700977.0
 [40,] -442538.7 701296.6
 [41,] -442649.7 701524.5
 [42,] -442788.4 701675.5
 [43,] -443024.7 701776.3
 [44,] -443292.6 701895.6
 [45,] -443662.9 701686.0
 [46,] -444524.6 701858.6
 [47,] -444485.9 701936.1
 [48,] -444442.5 701913.3
 [49,] -444433.3 701937.9
 [50,] -444363.5 702089.2
 [51,] -444265.6 701986.1
 [52,] -444721.1 701824.9
 [53,] -444720.8 701839.8
 [54,] -444695.4 701849.5
 [55,] -445057.1 701887.7
 [56,] -444993.3 701884.1
 [57,] -445036.0 701867.0
 [58,] -445411.2 701681.5
 [59,] -445818.8 701201.0
 [60,] -445830.7 701199.3
 [61,] -445871.2 701180.8
 [62,] -445951.3 701357.4
 [63,] -446012.8 701349.3
 [64,] -446613.8 701300.5
 [65,] -446048.3 701770.0
 [66,] -445907.0 701922.9
 [67,] -445773.6 701955.8
 [68,] -445224.1 701942.1
 [69,] -444901.5 701918.9
 [70,] -444898.0 701898.3
 [71,] -444240.1 702038.9
 [72,] -444435.4 701996.1
 [73,] -444447.5 702007.9
 [74,] -443831.5 701752.3
 [75,] -443407.9 701506.0
 [76,] -443413.0 701495.4
 [77,] -443519.7 701415.3
 [78,] -443267.0 701340.2
 [79,] -443260.2 701349.2
 [80,] -443115.7 701384.1
 [81,] -443077.4 701459.1
 [82,] -443025.2 701426.4
 [83,] -442962.3 701282.3
 [84,] -442947.7 701276.3
 [85,] -442723.0 701260.4
 [86,] -442408.9 701387.6
 [87,] -442319.4 701386.5
 [88,] -442293.5 701267.2
 [89,] -442305.6 701269.2
 [90,] -442229.4 701224.7
 [91,] -442207.0 701232.0
 [92,] -442129.4 701272.7
 [93,] -442130.5 701273.4
 [94,] -442081.5 701343.0
 [95,] -442096.6 701327.7
 [96,] -442058.0 701363.9
 [97,] -442036.5 701379.0
 [98,] -441777.3 701000.5
 [99,] -441721.0 701014.2
[100,] -441432.3 700993.5
[101,] -441453.3 700997.8
[102,] -441136.7 701319.5
[103,] -441001.4 701386.3
[104,] -440982.2 701388.8
[105,] -440952.3 701301.7
[106,] -440874.0 701289.4
[107,] -440863.5 701294.2
[108,] -440856.8 701320.2
[109,] -440853.4 701222.5
[110,] -441022.9 701155.5
[111,] -442464.1 701366.2
[112,] -442748.7 701275.7
[113,] -443334.8 702582.5
[114,] -443805.7 702625.4
[115,] -444346.9 702386.8
[116,] -444435.0 702446.3
[117,] -444309.5 702308.6
[118,] -444426.1 702396.3
[119,] -444244.5 702436.3
[120,] -444240.7 702437.3
[121,] -444247.7 702435.1
[122,] -444152.1 702626.4
[123,] -444157.5 702433.0
[124,] -444092.4 702412.6
[125,] -444088.3 702477.5
[126,] -444089.7 702446.9
[127,] -444084.3 702457.7
[128,] -444221.6 702194.4
[129,] -444291.4 702155.8
[130,] -444352.0 702102.3
[131,] -444348.8 702130.5
[132,] -444988.1 703317.4
[133,] -444966.6 703307.9
[134,] -444907.3 703278.2
[135,] -444566.9 702589.4
[136,] -444773.8 702304.8
[137,] -444781.7 702313.7
[138,] -444811.2 702316.7
[139,] -444872.8 702187.3
[140,] -445050.1 702078.3
[141,] -445091.3 702055.1
[142,] -445095.2 701960.4
[143,] -445964.2 700782.4
[144,] -445911.0 700805.5
[145,] -448432.0 699148.5
[146,] -448476.0 698833.6
[147,] -448426.4 698900.5
[148,] -448530.0 698516.8
[149,] -448386.4 697765.2
[150,] -448173.1 697726.4
[151,] -447817.5 697843.7
[152,] -447938.7 697579.2
[153,] -447936.9 697354.7
[154,] -447616.1 697863.2
[155,] -446237.8 697294.5
[156,] -446235.1 697311.9
[157,] -445919.8 697376.2
[158,] -445829.5 698040.0
[159,] -445439.8 697777.5
[160,] -445450.5 697785.5
[161,] -445646.6 697908.6
[162,] -445814.3 697196.4
[163,] -445771.9 697246.5
[164,] -445787.6 697223.3
[165,] -445812.7 697096.1
[166,] -445806.6 697107.7
[167,] -445822.3 697070.6
[168,] -445858.0 697069.6
[169,] -445986.6 697222.9
[170,] -446670.6 697772.8
[171,] -446620.4 697715.9
[172,] -446285.8 698334.3
[173,] -446991.8 698321.9
[174,] -446946.4 698324.9
[175,] -446295.9 696733.0
[176,] -446003.1 696836.0
[177,] -445911.7 696856.9
[178,] -446010.4 696827.8
[179,] -445832.5 696905.0
[180,] -445817.3 696865.4
[181,] -445835.4 696876.1
[182,] -445838.2 696854.8
[183,] -445811.1 696915.6
[184,] -445673.2 697016.9
[185,] -445948.4 697223.7
[186,] -445965.1 697213.9
[187,] -445948.7 697217.0
[188,] -445660.0 697297.7
[189,] -445669.1 697352.2
[190,] -445542.3 697235.0
[191,] -445454.1 697278.7
[192,] -445532.1 697239.8
[193,] -445448.5 697303.7
[194,] -445420.4 697282.5
[195,] -445411.6 697274.0
[196,] -445412.6 697272.5
[197,] -445531.9 697220.1
[198,] -445514.1 697479.3
[199,] -445533.3 697484.1
[200,] -445529.7 697496.3
[201,] -445643.4 697807.1
[202,] -445686.8 697681.8
[203,] -445657.1 697635.9
[204,] -445651.8 697645.1
[205,] -445926.6 697205.1
[206,] -445977.7 697184.4
[207,] -445859.8 697072.7
[208,] -445823.3 697063.3
[209,] -445529.9 697215.0
[210,] -445528.4 697203.8
[211,] -445391.3 697154.8
[212,] -445450.8 697292.1
[213,] -445686.4 697358.4
[214,] -445680.2 697608.6
[215,] -447930.8 698683.5
[216,] -448185.5 699073.1
[217,] -448262.3 698997.5
[218,] -447795.6 698537.6
[219,] -447778.4 698530.4
[220,] -447357.0 698420.1
[221,] -447741.7 698629.4
[222,] -447720.9 698872.7
[223,] -447648.1 699106.8
[224,] -447379.3 698306.0
[225,] -447692.8 698881.4
[226,] -447778.8 699159.3
[227,] -447772.2 699121.6
[228,] -447683.3 699162.6
[229,] -447775.4 699152.3
[230,] -447693.4 699106.6
[231,] -447627.2 699039.7
[232,] -447615.7 698864.3
[233,] -447705.2 698839.5
[234,] -447568.7 698601.8
[235,] -447975.8 698662.9
[236,] -448001.7 698680.0
[237,] -448137.3 700507.2
[238,] -447389.2 700395.1
[239,] -447821.5 699790.1
[240,] -447004.7 700016.4
[241,] -447210.2 699527.0
[242,] -447215.5 699645.0
[243,] -447231.4 699637.2
[244,] -447878.1 699060.1
[245,] -447196.6 698442.3
[246,] -446823.2 698570.4
[247,] -446933.0 697555.7
[248,] -446928.6 697555.7
[249,] -446963.9 697643.8
[250,] -447475.6 697976.2
[251,] -447338.9 698340.5
[252,] -447288.4 698288.2
[253,] -445784.9 698136.8
[254,] -446244.4 698795.6
[255,] -446319.8 698806.8
[256,] -446322.2 698806.0
[257,] -446298.3 698774.1
[258,] -446107.0 698943.9
[259,] -446066.4 698948.9
[260,] -446021.4 698950.2
[261,] -445895.1 698941.0
[262,] -445892.5 698933.6
[263,] -444618.6 700277.2
[264,] -446199.0 698845.0
[265,] -446228.6 698785.1
[266,] -443626.9 690057.4
[267,] -444387.3 690388.2
[268,] -444474.0 690213.3
[269,] -443501.3 689789.7
[270,] -443277.2 689898.7
[271,] -443272.2 689940.3
[272,] -443282.5 689901.2
[273,] -443380.1 689747.7
[274,] -443298.9 689885.0
[275,] -443481.7 689699.2
[276,] -443912.4 689717.7
[277,] -443617.5 689863.8
[278,] -443485.3 689694.1
[279,] -443921.8 689744.3
[280,] -443844.5 689583.4
[281,] -443888.1 689746.8


# range
range(err$x)
range(err$y)

# hpi-diag - scale
HpiScale <- Hpi.diag(x=xy)
# resolution (25m x 25m)
fhat.HpiScale <- kde(x=xy, H=HpiScale,
                     gridsize=c(round((max(xy$x)-min(xy$x))/25),
                                round((max(xy$y)-min(xy$y))/25)))

# export gridsize
im <- list(x=fhat.HpiScale$eval.points[[1]],
           y=fhat.HpiScale$eval.points[[2]],
           z=fhat.HpiScale$estimate)

# make an image-style list
image(im)
contour(im)

# convert 
SPim <- image2Grid(im)


Erreur dans image2Grid(im) : x or y not equally spaced

-- 
Nicolas Bergeron
bio., tech.

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to