3

I have two datasets:

  1. A raster file containing per-pixel vegetation classifications across Australia.

The file is described to have projection of EPSG:3577 https://epsg.io/3577. All additional meta data, along with data itself can be found at http://www.agriculture.gov.au/abares/forestsaustralia/forest-data-maps-and-tools/spatial-data/forest-cover

test <- raster('w001000.adf')
  1. A csv file containing data a latitude column, a longitude column, and various other variables.

N.B. THIS HAS BEEN UPDATED WITH MORE DATA

As this is a large dataset also, I will only provide the first 100 rows of this:

firms <- structure(list(latitude = c(-11.3647, -12.9932, -12.993, -13.0951, 
-13.0953, -13.0959, -11.365, -11.3162, -11.3596, -11.3591, -13.1387, 
-12.9689, -12.9737, -12.9884, -12.9734, -13.0666, -13.0713, -13.0709, 
-12.8471, -13.1394, -13.1542, -13.1593, -13.1535, -13.1582, -13.1296, 
-13.1247, -13.1198, -12.9881, -13.2038, -13.1888, -13.2071, -13.202, 
-13.1633, -13.0613, -13.0562, -13.0615, -13.0567, -13.1984, -14.4215, 
-13.6803, -14.5731, -14.57, -14.5667, -13.6866, -14.5409, -14.535, 
-14.5452, -14.4156, -14.4261, -14.4165, -11.4213, -11.402, -11.3722, 
-11.4016, -11.3525, -13.568, -13.0624, -13.0571, -13.0653, -13.9651, 
-13.9622, -13.9742, -13.1595, -13.1577, -13.08, -13.1469, -13.1978, 
-13.078, -13.6888, -13.6926, -13.697, -13.6934, -12.8471, -12.9913, 
-13.5639, -13.5589, -13.9713, -14.5302, -14.5383, -13.1881, -13.188, 
-13.1477, -13.1914, -13.0946, -13.1097, -13.2068, -13.2033, -13.1078, 
-12.1441, -13.113, -13.1109, -13.0646, -13.0722, -13.1065, -13.1008, 
-13.0891, -13.1093, -12.8281, -12.8254, -12.8332, -12.8361, -14.4445, 
-11.3031, -11.4108, -11.3017, -13.1634, -13.2381, -13.1916, -13.1463, 
-12.9782, -13.1619, -13.1405, -13.2012, -13.2285, -13.1649, -13.1189, 
-13.1537, -13.1552, -13.1107, -13.1855, -13.1122, -13.1901, -13.1523, 
-13.2396, -13.1871, -13.5535, -13.1092, -13.0847, -13.1077, -13.0862, 
-12.9797, -11.4122, -13.0555, -13.3021, -13.3007, -13.5668, -13.5655, 
-13.9625, -13.9598, -13.9611, -14.4546, -14.5819, -13.9541, -13.9638, 
-14.3936, -14.3969, -14.3952, -14.465, -14.4549, -13.5597, -13.9603, 
-13.9572, -13.9751, -13.1266, -13.1642, -13.5659, -13.5665, -11.4949, 
-11.4879, -13.7611, -13.7578, -11.4999, -11.4054, -11.4196, -11.5111, 
-13.5695, -13.3004, -13.0487, -13.3148, -12.1531, -12.1709, -12.1489, 
-12.1472, -11.376, -11.3834, -11.4175, -11.3913, -11.3434, -14.4074, 
-14.3831, -14.3848, -14.3768, -14.4437, -14.4454, -14.3993, -14.4374, 
-14.4356, -14.5821, -13.5501, -13.1041, -13.1439, -13.1217, -13.1232, 
-13.1137, -12.8453, -12.8469, -13.1535, -13.1121, -13.1025, -13.5475, 
-13.051, -13.0523, -13.042, -13.0914, -13.0819, -12.9708, -12.1028, 
-12.8357, -12.826, -14.3779, -13.8198, -13.8179, -13.0768, -12.9684, 
-13.0789, -13.1293, -13.1374, -13.0549, -13.1173, -12.9818, -13.827, 
-13.8294, -13.8158, -13.6621, -13.6829, -13.6637, -13.5698, -13.6813, 
-13.6717, -13.6733, -13.5623, -13.1491, -13.1547, -13.6268, -13.5581, 
-13.9532, -13.6053, -14.3692, -13.9548, -14.5869, -14.5819, -13.5358, 
-13.5455, -13.5439, -13.5456, -14.4888, -14.4857, -11.4709, -11.3362, 
-12.1503, -12.16, -12.0422, -11.3479, -11.2954, -11.3726, -11.3787, 
-11.37, -11.4266, -12.9635, -12.995, -12.9545, -12.76, -12.844, 
-12.765, -12.7678, -13.0578, -13.0561, -13.0497, -13.0745, -13.0719, 
-13.0629, -13.0776, -13.0892, -12.9695, -11.4382, -11.424, -11.3988, 
-11.4015, -11.387, -11.4214, -11.3813, -12.0491, -12.0569, -12.0449, 
-11.4407, -11.4356, -11.4523, -11.4497, -11.5055, -11.5178, -11.402, 
-13.308, -12.5298, -11.5028, -11.48, -11.4908, -11.489, -13.8435, 
-14.4691, -14.4881, -14.4826, -14.484, -14.4745, -14.4787, -13.8232, 
-13.8285, -11.3888, -11.3642, -11.3628, -11.3403, -11.3417, -11.291, 
-11.2988, -11.308, -11.2895, -14.4508, -12.1711, -11.5224, -12.0546, 
-14.4868, -14.4855, -14.4762, -14.4672, -14.4582, -13.0785, -12.9626, 
-12.3165, -13.0695, -13.8213, -13.8289, -13.8199, -13.8275, -13.8303, 
-13.8352, -13.8366, -13.8393, -12.841, -13.1678, -13.1691, -11.5238, 
-11.5148, -11.4981, -11.4106, -11.4134, -11.412, -13.5573, -13.6397, 
-13.641, -13.6488, -13.4082, -14.3549, -14.3603, -14.4491, -14.372, 
-14.3734, -14.3747, -14.3761, -14.3856, -14.387, -14.3973, -14.3987, 
-14.3929, -14.4388, -14.4374, -14.4361, -11.4897, -11.4764, -14.5707, 
-14.5612, -14.5599, -13.4141, -13.4114, -14.3612, -14.3613, -14.4416, 
-14.4404, -14.4241, -14.427, -14.3698, -14.4373, -14.3847, -14.37, 
-14.4257, -14.4387, -14.3645, -14.3642, -12.9611, -12.8652, -12.8619, 
-12.8804, -12.8771, -12.8634, -12.8603, -12.8786, -12.8755, -12.9645, 
-13.8424, -13.8493, -13.8334, -13.8484, -13.8326, -13.84, -13.8362, 
-13.8521, -13.8299, -13.8458, -14.5093, -14.5202, -11.5335, -11.3637, 
-11.4206, -11.3672, -12.1302, -12.3342, -14.453, -14.4908, -14.4985, 
-14.4998, -14.4895, -13.6424, -13.6438, -14.5188, -14.3536, -13.0503, 
-13.0489, -14.378, -13.0518, -14.3613, -12.8677, -12.8664, -13.8509, 
-13.8522, -13.86, -13.8614, -13.8692, -13.8286, -13.8194, -13.8127, 
-13.814, -11.3026, -13.0393, -13.0407, -11.4671, -11.5338, -11.4933, 
-12.2867, -12.5189, -14.3778, -14.5303, -14.5318, -14.4963, -13.8511, 
-12.8678, -14.5281, -11.2976, -11.5864, -13.6982, -13.6944, -13.8282, 
-13.8317, -13.6207, -12.2448, -13.2093, -13.8147, -14.5337, -14.5399, 
-14.5441, -14.5378, -12.2237, -12.2194, -12.2216, -12.9311, -12.9295, 
-12.9406, -12.939, -12.9374, -14.3193, -13.8666, -13.8299, -14.329, 
-14.3306, -13.8314, -13.8407, -13.8392, -14.3825, -12.528, -13.8128, 
-13.8143, -13.8221, -12.1311, -13.6283, -13.627, -13.618, -13.5081, 
-13.5171, -13.5158, -13.5094, -13.5184, -11.4234, -11.3859), 
    longitude = c(132.5057, 132.7868, 132.7811, 132.6699, 132.755, 
    132.7621, 132.4814, 132.2966, 132.4508, 132.4752, 132.6555, 
    132.7351, 132.7623, 132.7596, 132.7567, 132.7676, 132.7946, 
    132.7875, 132.8221, 132.6616, 132.6589, 132.6004, 132.6528, 
    132.5946, 132.6919, 132.7495, 132.7221, 132.7539, 132.3437, 
    132.347, 132.3499, 132.321, 132.6224, 132.8172, 132.7902, 
    132.8244, 132.7974, 132.3147, 133.5471, 131.3617, 134.9152, 
    134.8975, 134.905, 131.3955, 132.2728, 132.2639, 132.2491, 
    133.5394, 133.5463, 133.5136, 132.4018, 132.4188, 132.4135, 
    132.4266, 132.4386, 130.3926, 130.2648, 130.2528, 130.247, 
    130.2185, 130.2354, 130.2375, 132.2706, 132.2652, 132.7954, 
    132.6715, 132.3027, 132.7999, 131.3748, 131.3539, 131.3493, 
    131.3703, 130.8593, 132.7708, 134.2239, 134.2177, 130.255, 
    132.2208, 132.227, 132.6218, 132.5971, 132.7063, 132.5921, 
    132.7815, 132.7833, 132.5939, 132.5989, 132.7896, 132.6393, 
    132.7546, 132.7609, 132.6392, 132.6482, 132.7773, 132.785, 
    132.787, 132.7934, 132.8845, 132.8679, 132.861, 132.8777, 
    133.5892, 132.274, 132.3827, 132.2643, 132.7069, 132.5823, 
    132.5996, 132.2682, 132.7668, 132.6962, 132.2646, 132.5983, 
    132.5837, 132.7176, 132.7631, 132.7082, 132.7189, 132.7752, 
    132.2728, 132.7859, 132.5891, 132.6976, 132.5929, 132.5955, 
    134.2451, 132.7644, 132.6593, 132.7537, 132.67, 132.7776, 
    132.3925, 130.2738, 130.4491, 130.44, 130.3719, 130.3627, 
    130.244, 130.2256, 130.2348, 133.597, 133.5479, 130.2513, 
    130.2532, 133.5101, 133.5347, 133.5224, 133.5956, 132.6825, 
    134.239, 130.2061, 130.2342, 130.2083, 132.7707, 132.7128, 
    130.3504, 130.3552, 130.8875, 130.8818, 130.661, 130.6533, 
    133.009, 132.3838, 132.3682, 133.0018, 130.3285, 130.4404, 
    130.2588, 130.4421, 134.2533, 134.2818, 134.247, 134.2599, 
    132.3734, 132.3639, 132.3853, 132.3994, 132.4378, 133.5586, 
    133.5203, 133.5092, 133.4965, 133.5935, 133.5824, 133.5458, 
    133.5695, 133.5807, 133.5544, 130.3783, 132.7876, 132.7833, 
    132.8012, 132.7907, 132.7892, 132.8677, 132.8572, 132.7849, 
    132.7997, 132.7981, 130.3967, 130.2662, 130.257, 130.2649, 
    132.6788, 132.6773, 132.7752, 134.4864, 132.8665, 132.865, 
    133.5169, 132.3917, 132.403, 132.6702, 132.7807, 132.6868, 
    132.7991, 132.81, 132.8329, 132.8006, 130.2475, 132.3988, 
    132.3842, 132.3972, 130.0691, 130.0616, 130.0585, 130.4102, 
    130.0722, 130.0706, 130.0601, 130.3297, 132.799, 132.7943, 
    130.0417, 134.2477, 130.2507, 130.7122, 133.4978, 130.24, 
    133.5572, 133.5491, 130.3648, 130.3664, 130.3774, 130.3721, 
    133.5861, 133.58, 132.8184, 132.4393, 132.6677, 132.6597, 
    132.8492, 132.4413, 131.9002, 132.3625, 132.3693, 132.3786, 
    132.296, 132.7651, 132.3542, 132.7469, 132.885, 132.854, 
    132.8908, 132.8746, 130.2776, 130.2887, 130.265, 132.6425, 
    132.6582, 132.6405, 132.6824, 132.6844, 132.7718, 132.298, 
    132.3117, 132.5397, 132.5232, 132.5377, 132.3276, 132.3534, 
    132.8383, 132.8342, 132.8322, 132.2823, 132.3138, 132.2843, 
    132.3001, 133.01, 133.0121, 132.3735, 130.452, 130.922, 130.8745, 
    130.8836, 130.5654, 130.5583, 132.4203, 133.6163, 133.6054, 
    133.6138, 133.5827, 133.6078, 133.5912, 132.3939, 132.4231, 
    132.5441, 132.3833, 132.3737, 132.4614, 132.4708, 131.9085, 
    131.8971, 132.3104, 131.8986, 132.687, 132.7188, 132.9995, 
    132.8626, 133.6217, 133.6124, 133.6108, 133.6122, 133.6135, 
    132.6883, 132.7753, 134.1365, 132.6897, 132.42, 132.4093, 
    132.4106, 132.4, 132.4186, 132.3892, 132.3986, 132.4172, 
    132.8851, 132.7915, 132.8007, 133.0087, 133.0101, 133.022, 
    132.3177, 132.3367, 132.3272, 134.2539, 134.3808, 134.3903, 
    134.3794, 134.2436, 133.4738, 133.5108, 133.6149, 133.528, 
    133.5373, 133.5465, 133.5558, 133.558, 133.5672, 133.5752, 
    133.5845, 133.4812, 133.6069, 133.5976, 133.5884, 130.5716, 
    130.8799, 133.5652, 133.5631, 133.5538, 134.2249, 134.2476, 
    133.484, 133.4793, 133.5821, 133.5748, 133.6072, 133.5805, 
    133.5351, 133.6015, 133.5414, 133.5399, 133.5731, 133.6089, 
    133.452, 133.4565, 132.7671, 132.8334, 132.8617, 132.8344, 
    132.8633, 132.8404, 132.8686, 132.8414, 132.8703, 132.7629, 
    132.4285, 132.3632, 132.3613, 132.422, 132.4202, 132.3544, 
    132.3878, 132.3897, 132.3942, 132.3961, 134.7306, 134.7539, 
    132.986, 132.3786, 132.2944, 132.349, 134.4285, 134.1347, 
    133.6209, 133.6137, 133.6243, 133.6151, 133.623, 134.3973, 
    134.388, 132.4227, 133.543, 131.068, 131.0787, 133.5655, 
    131.0574, 133.5536, 132.867, 132.8762, 132.401, 132.3914, 
    132.4024, 132.3927, 132.4037, 132.4271, 132.4258, 132.4185, 
    132.4088, 131.901, 131.0773, 131.0667, 130.881, 133.0046, 
    133.0294, 133.9765, 130.9223, 133.5812, 132.4285, 132.439, 
    133.6219, 132.4026, 132.8776, 132.4355, 131.914, 130.5194, 
    130.0711, 130.0772, 132.4452, 132.4377, 130.0612, 132.763, 
    130.556, 132.4396, 134.7527, 134.7482, 134.7545, 134.7611, 
    134.7938, 134.8006, 134.7866, 132.7218, 132.7321, 132.7233, 
    132.7336, 132.744, 133.4685, 132.3907, 132.4454, 133.4702, 
    133.4594, 132.4355, 132.437, 132.4469, 133.5857, 130.9174, 
    132.4326, 132.4227, 132.4341, 134.4324, 130.0323, 130.0416, 
    130.0403, 130.3675, 130.3689, 130.3781, 130.3583, 130.3597, 
    132.2726, 132.3651), brightness = c(319.6, 333.6, 334.3, 
    325.7, 323.8, 321.8, 331.2, 316.6, 320.7, 330.7, 334.1, 317.9, 
    321.8, 343.4, 323.6, 331.8, 328.9, 334.4, 330.6, 336.5, 332.4, 
    350.8, 332.7, 347.2, 328.9, 330.6, 328.2, 335.4, 335, 319.8, 
    325.8, 330.5, 328.9, 326.1, 323.1, 326.5, 327.1, 328.3, 327.8, 
    320.9, 329.2, 349.2, 353.1, 318.4, 335.3, 338.5, 336.3, 329.3, 
    328.5, 331, 321, 334.8, 329.3, 329.8, 324.3, 329.8, 338.7, 
    342.2, 331, 328.3, 342.8, 328.4, 327.4, 328.5, 328.8, 347.4, 
    333.9, 328.6, 335.9, 335.9, 328.8, 336.2, 337.5, 320.9, 325.2, 
    329, 330, 310.3, 312, 307.3, 313.7, 336.5, 317.7, 307.3, 
    322.4, 313, 315.9, 316.8, 302.5, 309.2, 317.2, 307.7, 306.5, 
    306.2, 313.6, 305.2, 305.4, 310.9, 331.7, 316.9, 309.8, 304.7, 
    355.2, 376.4, 336.7, 353.6, 352.2, 333.8, 335.3, 333.6, 335, 
    335, 341.4, 350.7, 336.7, 345.3, 341.8, 343.6, 334.5, 328.8, 
    330.6, 334.6, 330.6, 330.6, 339.3, 327.8, 334, 347.7, 334.3, 
    342.2, 337.2, 376.9, 326.7, 344, 353, 335, 364.7, 338, 339.2, 
    345.1, 341.4, 326.7, 348, 332, 332.3, 333.4, 331.6, 327.8, 
    328.2, 331.6, 351.6, 340.3, 334.2, 330.6, 326.3, 347.4, 353.5, 
    320, 329.2, 335.7, 330.9, 326.4, 338.6, 359.8, 325.5, 337.2, 
    332.9, 323.8, 343.8, 332.4, 324.1, 324.9, 326.5, 336.6, 330.9, 
    341, 328.1, 327.5, 308.6, 312.8, 314.2, 326.5, 344.9, 331.7, 
    313, 306.9, 309.3, 307.8, 308.6, 321.5, 324.5, 309.9, 320.8, 
    321.5, 306, 313.2, 311.1, 312.9, 316.1, 306.5, 318, 308.9, 
    319.8, 311.2, 307.7, 301.9, 309, 308.2, 315.9, 303.5, 304.5, 
    302.1, 311.8, 306.8, 331, 306.2, 304.1, 304.9, 306.6, 317.4, 
    353.3, 355.2, 329.4, 388.3, 398.4, 415.1, 337.1, 350, 403, 
    434.5, 336.4, 344.6, 341.1, 339.9, 329.1, 338.5, 335.3, 338.7, 
    332.6, 332.1, 333.7, 347.9, 344, 346.7, 362.5, 339.1, 336.8, 
    320.7, 354.8, 328.9, 328.1, 332.9, 332.6, 322.3, 359.8, 347.8, 
    327.9, 339.4, 340.5, 335.2, 337.6, 335.8, 334.8, 334.2, 332.4, 
    344.8, 329.7, 328.8, 337.4, 339.9, 338.7, 334.2, 338.3, 335.2, 
    351.1, 351.9, 327, 332.8, 326, 336.9, 333.8, 359.7, 328.5, 
    350.3, 328.9, 329, 354, 337.5, 329, 324.2, 332.5, 392.2, 
    327.9, 332.1, 329.9, 328.8, 330.1, 325.6, 310.9, 347.8, 346.8, 
    312.2, 338.7, 334.9, 306.8, 344.8, 329, 330.2, 332.1, 332.8, 
    333.7, 331.9, 341.2, 332.9, 336.1, 330.7, 333.5, 340.3, 326.5, 
    330.8, 334, 337.4, 343.1, 332.7, 337.5, 335, 326.1, 335.5, 
    340.8, 344, 340.8, 375, 342.1, 372.1, 328.6, 333.9, 327, 
    335, 337.7, 339.6, 331.9, 338.1, 337, 336.6, 348.4, 338.6, 
    332, 330.3, 339.5, 332, 336.6, 342.7, 335.1, 333.7, 338.5, 
    341.9, 337.3, 352.9, 361.3, 334.1, 334.8, 346.3, 336.5, 341, 
    335.3, 327.4, 333.2, 332.7, 337.3, 332.8, 344.3, 352.1, 331.1, 
    333.3, 335.1, 335.9, 331, 349.7, 338.9, 349.3, 328, 346.2, 
    333.4, 334.1, 327.7, 329.9, 325.8, 328, 332.2, 334.5, 335.5, 
    334.7, 324.2, 343.2, 327.5, 325.5, 325.7, 341.6, 326.7, 341.2, 
    329.8, 326.9, 378.8, 369.4, 344.8, 393, 329.8, 330.4, 318.2, 
    322.3, 323.4, 323.4, 318.8, 319.1, 309.7, 332.8, 335.9, 343.1, 
    342.2, 307.8, 311.1, 308.6, 314.6, 315.9, 328.7, 313.5, 305.3, 
    320.4, 314.7, 311.7, 324.2, 325.5, 332.3, 319, 308.3, 312.2, 
    307.9, 311.8, 311.3, 308.7, 307.2, 311.9, 304.6, 306.5, 305.3, 
    307.8, 313.1, 307.4, 309.5, 306.9, 307.4, 308.8, 307.5, 320.3, 
    315.6, 319.2, 319.4, 322.6, 328.8, 326.2, 321.8, 322.7, 321.4, 
    324.6, 338.7, 336.3, 337.4, 337, 337.5, 335.3, 327.2, 351.1, 
    337.5, 391.5, 374.2, 347.7, 344.3, 361.8, 380.7, 376.1, 370.3, 
    388.9, 338.3, 335.3, 333.8, 333.8, 331.5, 353.4, 338.9, 327.8, 
    326.3, 326, 337.9, 348.7, 367.1, 366.6, 338.7, 334.8, 335.6, 
    342.9), acq_date = c("2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", 
    "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-01", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", "2018-10-02", 
    "2018-10-02", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-03", 
    "2018-10-03", "2018-10-03", "2018-10-03", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", "2018-10-04", 
    "2018-10-04", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", "2018-10-05", 
    "2018-10-05", "2018-10-05")), row.names = c(NA, -500L), class = c("data.table", 
"data.frame"), .internal.selfref = <pointer: 0x103806ee0>)

This file is then adjust as such...

firms$acq_date <- as.Date(firms$acq_date,format="%Y-%m-%d")

xy <- firms[,c(2,1)]
firms_pts <- SpatialPointsDataFrame(coords = xy, data = firms,
                                    proj4string = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
firms_lyr <- spTransform(firms_pts, crs(test))

THE GOAL

I want to have a map that shows the basemap with only one forest type highlighted, and only showing points corresponding with that forest type.

Forest type is one of the attributes in the raster (FOR_TYPE).

I have been trying to do this in R, but am open to solutions in Grass or Python.

I tried to convert the raster into polygons using the following options, but none of these processes finished, and R would just crash.

1.

derat.method <- deratify(test,'FOR_TYPE')

2.

# 1. A function to change the attribute that gets mapped - this was useful for plotting but not sure here...
switch_att <- function(r, att) {
  r[] <- levels(r)[[1]][values(r), att]
  r
}
r2p.method <- rasterToPolygons(switch_att(test, 'FOR_TYPE'),dissolve=T)

3.

I also tried to extract the coordinates of the pixels of interest to clip the data frame

rfor.inx <- grep("Rainforest", test@data@attributes[[1]]$FOR_TYPE)
rfor.coord <- as.data.table(coordinates(test)[rfor.inx,])
ccc <- coordinates(firms_lyr)
round.coord <- round(ccc)

From here, I rounded the coordinates for the data file and renamed it such that it matches the raster.

firms_clip <- round(as.data.table(round(coordinates(firms_lyr)))/100)
rfoor_clip <- round(rfor.coord/100)
colnames(rfoor_clip) <- c("longitude","latitude")

Then the I tried to merge the raster and the spatial points, but none of the points matched when it was clear they should have.

merge(firms_clip,rfoor_clip,by=c("longitude"))

Is there a different way to complete this task that I am missing?


EDIT:

So the new method with help from @Where's my towel the first answer gives the new method:

a Label rainforest cells 1 and everything else 0

# which values of "test" stand for Rainforest?
rainf.codes <- grep("Rainforest", test@data@attributes[[1]]$FOR_TYPE)

# prepare matrix with reclassification information (576 is the number of unique 'FOR_TYPE's
is <- 1:576
becomes <- rep(x = 0, times=length(is))
becomes[rainf.codes] <- 1
recl <- cbind(is, becomes)               

# reclassify into 1=Rainforest and 0=everything else
# (this may take a while)
rainf <- reclassify(test, rcl = recl)

b Extract points in firms_lyr that fall on top of rainforest pixels

# use extract() to find out which points fall into rainforest pixels
firms_lyr$rainforest <- extract(x = rainf, y=firms_lyr)
# make a subset that only contains those points
firms_rainf <- subset(firms_lyr, firms_lyr$rainforest ==1)

c Plot

# Colours
mycols <- colors()[c(15, 258)]

# Raster plot
plt <- levelplot(rainf, 
                 margin=TRUE,  
                 colorkey=FALSE,  
                 par.settings=list(axis.line=list(col='black')),
                 scales=list(draw=FALSE), 
                 col.regions=mycols)

# Spatial points layer
plt + layer(sp.points(firms_rainf, col="red",pch=16, cex=0.1))

However, there is still an issue as is seen in these images, 1 and 2, where points are being extracted that do not lie on top of rainforest cells.

To assist the tackling of this problem, the dataset for firms has been replaced with a larger piece of the point data that includes the points in the images

  • I was thinking firms_lyr$forest <- extract(test, firms_lyr) - you don't have to use all that other stuff to extract values from raster with points. I think the rest is about how you plot the raster and then put certain points on top? – mdsumner Nov 6 at 10:42
  • thanks, but the test raster covers the whole extent of the firms dataset, and so it is just a part of the raster which has the necessary information. The FOR_TYPE attribute in the raster has one classification ("Rainforest") which covers the regions i am interested in – JMilner Nov 6 at 10:47
1

+If I understood correctly, you want a raster map of all the rain forest areas in Australia. And on top of that you want to plot those points that are located within the rain forest - correct?

Then the following approach using a combination of reclassify() and extract() works for me:

library(data.table)
library(sp)
library(raster)

#### this section is the same as in the question:
firms <- structure(...) #see question above

test <- raster('w001000.adf')
firms$acq_date <- as.Date(firms$acq_date,format="%Y-%m-%d")
xy <- firms[,c(2,1)]
firms_pts <- SpatialPointsDataFrame(coords = xy, data = firms,
                                    proj4string = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
firms_lyr <- spTransform(firms_pts, crs(test))

#### this section is new:
# which values of "test" stand for Rainforest?
rainf.codes <- grep("Rainforest", test@data@attributes[[1]]$FOR_TYPE)

# prepare matrix with reclassification information
is <- 1:576
becomes <- rep(x = 0, times=length(is))
becomes[rainf.codes] <- 1
recl <- cbind(is, becomes)               

# reclassify into 1=Rainforest and 0=everything else
# (this may take a while)
rainf <- reclassify(test, rcl = recl)

# plot with all points
plot(rainf)
points(firms_lyr)

# use extract() to find out which points fall into rainforest pixels
firms_lyr$rainforest <- extract(x = rainf, y=firms_lyr)
# make a subset that only contains those points
firms_rainf <- subset(firms_lyr, firms_lyr$rainforest ==1)

# plot
plot(rainf)
points(firms_rainf, col="blue")

With the provided sample of point locations, this leaves exactly one point that lies within a rain forest cell.

  • Thanks! Out of interest, where does the 576 come from in is <- 1:576 – JMilner Nov 7 at 10:57
  • 1
    576 is the number of possible values in the raster that somehow represent the state, forest type and forest source. I got that from looking at test@data@attributes, basically that's nrow(test@data@attributes). As for the axes, reprojecting from EPSG:3577 to something like WGS84 might work. But there's probably a better solution, so a new question might be a good idea. – Where's my towel Nov 7 at 12:23
  • Ok so this actually hasnt solved the problem, see image and edit to the question – JMilner Nov 8 at 13:50
  • 1
    I can not reproduce that with the new data. I've exported the results as a TIF (raster) and a shapefile (points) and loaded them both into QGIS. Zoomed in to all the points individually and they all lie in the rainforest areas. In your plot the raster seems to have a much coarser resolution than the actual data and many rainforest areas seem to be missing – did you do some kind of spatial aggregation or re-projection? Have you tried regular base R plotting commands? – Where's my towel Nov 8 at 15:21
  • 1
    Ok Thank you for your help again. It seems, the resolution was low. So I added a maxpixels=2e+06 command to the levelplot code. I am using levelplot just because I am more familiar with it, thus making scale bars is easier etc. – JMilner Nov 8 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.