Chapter 6 Evaluating the Sample

For the cities we do not implement the pair-wise approach, because we assume travel costs will be relatively low anyways.
The function oversample_wrapper_non_pair returns a SpatialPolygonsDataFrame with the sampled units and replacements units. The sampled units are controlled by zooming into satelitte images to determine if there are actually people living in those units. For example, Figure 6.1 shows a clearly populated site.

6.1 Nairobi

make_pic("Nairobi@1@1",nairobi_sample_150,image_name = "example")

sapply(nairobi_replaced_id$Type %>% 
         unique,make_pic_loop,
              data = nairobi_replaced_id,
              sp_obj = nairobi_sample_150,
       addition="Nairobi")

Figure 6.1: Example of a populated site.

Example of a populated site.

6.1.1 Identifying empty and underpopulated units

  • The figures 6.2 to 6.4 seem to not be populated but business/industrial sites and will be replaced.
  • Figure 6.5 to 6.9 seem to uninhabited and will be replaced.
  • Figure 6.10 to 6.15 seem to be very sparsely populated and for each a replacement unit is drawn. (But we keep them in?)
  • Figure 6.16 seems to be resort and will be replaced as well.

6.1.1.1 Industry

Figure 6.2: Industrial site in Nairobi. (ID = Nairobi@2@25 )

Industrial site in Nairobi. (ID = Nairobi@2@25 )

Figure 6.3: Industrial site in Nairobi. (ID = Nairobi@3@8 )

Industrial site in Nairobi. (ID = Nairobi@3@8 )

Figure 6.4: Industrial site in Nairobi. (ID = Nairobi@3@16 )

Industrial site in Nairobi. (ID = Nairobi@3@16 )

6.1.1.2 Empty units

Figure 6.5: Empty site in Nairobi. (ID = Nairobi@2@17 )

Empty site in Nairobi. (ID = Nairobi@2@17 )

Figure 6.6: Empty site in Nairobi. (ID = Nairobi@2@41 )

Empty site in Nairobi. (ID = Nairobi@2@41 )

Figure 6.7: Empty site in Nairobi. (ID = Nairobi@5@8 )

Empty site in Nairobi. (ID = Nairobi@5@8 )

Figure 6.8: Empty site in Nairobi. (ID = Nairobi@6@16 )

Empty site in Nairobi. (ID = Nairobi@6@16 )

Figure 6.9: Empty site in Nairobi. (ID = Nairobi@7@3 )

Empty site in Nairobi. (ID = Nairobi@7@3 )

6.1.1.3 Almost empty units

Figure 6.10: Almost empty site Nairobi. (ID = Nairobi@4@17 )

Almost empty site Nairobi. (ID = Nairobi@4@17 )

Figure 6.11: Almost empty site Nairobi. (ID = Nairobi@6@14 )

Almost empty site Nairobi. (ID = Nairobi@6@14 )

Figure 6.12: Almost empty site Nairobi. (ID = Nairobi@6@17 )

Almost empty site Nairobi. (ID = Nairobi@6@17 )

Figure 6.13: Almost empty site Nairobi. (ID = Nairobi@7@3 )

Almost empty site Nairobi. (ID = Nairobi@7@3 )

Figure 6.14: Almost empty site Nairobi. (ID = Nairobi@7@8 )

Almost empty site Nairobi. (ID = Nairobi@7@8 )

Figure 6.15: Almost empty site Nairobi. (ID = Nairobi@8@2 )

Almost empty site Nairobi. (ID = Nairobi@8@2 )

6.1.1.4 Others

Figure 6.16: Not empty but maybe resort. (ID = Nairobi@2@11 )

Not empty but maybe resort. (ID = Nairobi@2@11 )

6.1.2 Replacement units

Table 6.1: Number of units that need to be resampled from each bin.

Bin Frequency
2 4
3 2
4 1
5 1
6 3
7 3
8 1

If the resampled unit is empty, it is left out.

make_pic_loop(type = "replaced",
              data = nairobi_replacement_units,
              sp_obj = nairobi_1k_sample_complete,
              addition = "Nairobi")

Figure 6.17: Replacement units (ID = Nairobi@2@47 )

Replacement units (ID = Nairobi@2@47 )

Figure 6.18: Replacement units (ID = Nairobi@2@48 )

Replacement units (ID = Nairobi@2@48 )

Figure 6.19: Replacement units (ID = Nairobi@2@49 )

Replacement units (ID = Nairobi@2@49 )

Figure 6.20: Replacement units (ID = Nairobi@2@50 )

Replacement units (ID = Nairobi@2@50 )

Figure 6.21: Replacement units (ID = Nairobi@3@23 )

Replacement units (ID = Nairobi@3@23 )

Figure 6.22: Replacement units (ID = Nairobi@3@24 )

Replacement units (ID = Nairobi@3@24 )

Figure 6.23: Replacement units (ID = Nairobi@4@24 )

Replacement units (ID = Nairobi@4@24 )

Figure 6.24: Replacement units (ID = Nairobi@4@26 )

Replacement units (ID = Nairobi@4@26 )

Figure 6.25: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@5@11 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@5@11 )

Figure 6.26: Replacement units (ID = Nairobi@5@12 )

Replacement units (ID = Nairobi@5@12 )

Figure 6.27: Replacement units (ID = Nairobi@6@23 )

Replacement units (ID = Nairobi@6@23 )

Figure 6.28: Replacement units (ID = Nairobi@6@24 )

Replacement units (ID = Nairobi@6@24 )

Figure 6.29: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@6@25 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@6@25 )

Figure 6.30: Replacement units (ID = Nairobi@6@26 )

Replacement units (ID = Nairobi@6@26 )

Figure 6.31: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@9 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@9 )

Figure 6.32: Replacement units (ID = Nairobi@7@10 )

Replacement units (ID = Nairobi@7@10 )

Figure 6.33: Replacement units (ID = Nairobi@7@12 )

Replacement units (ID = Nairobi@7@12 )

Figure 6.34: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@13 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@13 )

Figure 6.35: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@14 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@14 )

Figure 6.36: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@15 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@15 )

Figure 6.37: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@17 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@7@17 )

Figure 6.38: Replacement units (ID = Nairobi@7@18 )

Replacement units (ID = Nairobi@7@18 )

Figure 6.39: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@8@3 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@8@3 )

Figure 6.40: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@8@4 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@8@4 )

Figure 6.41: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@8@5 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Nairobi@8@5 )

Figure 6.42: Replacement units (ID = Nairobi@8@6 )

Replacement units (ID = Nairobi@8@6 )
coord_string <- c("S03°23.602’;E037°40.783’
S03°23.604’;E037°40.756’
S03°16.746’;E038°18.349’
S03°16.724’;E038°18.337’
S-1.842537;E36.785076
S-1.839773;E36.782486
S-1.389256;E36.866333
S-1.389330;E36.683559
S-1.994650;E36.867916
S-1.994853;E36.866333
S01°06.434’;E036°38.363’
S01°06.461’;E036°38.355’
S01°00.679’;E036°54.028’
S01°00.673’;E036°54.022’
S01°14.124’;E036°56.020’
S01°14.152’;E036°56.081’")

coord_matrix <- coord_string %>% 
  strsplit("\n") %>% 
  unlist() %>% 
  strsplit(";") %>% 
  do.call(rbind,.)

coord_degree <- coord_matrix[grep("°",coord_matrix[,1]),] %>% 
  apply(2,function(y) {
    y %>% 
      gsub("S","-",.,fixed=TRUE) %>% 
  gsub("[A-Z]","",.) %>%
  strsplit("[°\\.]") %>% 
  lapply(function(x) {
    x <- x %>% 
      gsub("[^0-9\\-]","",.) %>% 
      as.numeric()
    x[1] + x[2]/60 + x[3]/3600
  }) %>% 
      unlist()
})
  
coord_decimal <- coord_matrix[!grepl("°",coord_matrix[,1]),] %>% 
  gsub("[A-Z]","",.) %>% 
  apply(2,as.numeric)

# nairobi_fdgs <- rbind(coord_degree,coord_decimal) %>% 
#   as.data.frame() %>% 
#   SpatialPoints(CRS("+init=epsg:4326")) %>% 
#   spTransform(CRS(proj4string(nairobi_1k_sample_complete_100m)))
#   
# 
# if (over(nairobi_1k_sample_complete_100m,nairobi_fdgs,returnList = FALSE) %>% 
#   is.na() %>% 
#   `!` %>% 
#   which() %>% 
#   length() == 0) cat("No overlap between sample and FDGs.")

6.2 Lusaka

Table 6.2: Lusaka: Number of units that need to be resampled from each bin.

Bin Frequency
1 4
2 8
3 8
4 9
5 4
6 4
7 6
8 4
sapply(lusaka_replaced_id$Type %>% 
         unique,make_pic_loop,
              data = lusaka_replaced_id,
              sp_obj = lusaka_sample_150,
       addition = "Lusaka")

6.2.0.1 Industry

Figure 6.43: Industrial site in Lusaka (ID = Lusaka@1@7 )

Industrial site in Lusaka (ID = Lusaka@1@7 )

Figure 6.44: Industrial site in Lusaka (ID = Lusaka@1@10 )

Industrial site in Lusaka (ID = Lusaka@1@10 )

Figure 6.45: Industrial site in Lusaka (ID = Lusaka@2@25 )

Industrial site in Lusaka (ID = Lusaka@2@25 )

Figure 6.46: Industrial site in Lusaka (ID = Lusaka@3@9 )

Industrial site in Lusaka (ID = Lusaka@3@9 )

Figure 6.47: Industrial site in Lusaka (ID = Lusaka@3@17 )

Industrial site in Lusaka (ID = Lusaka@3@17 )

Figure 6.48: Industrial site in Lusaka (ID = Lusaka@4@24 )

Industrial site in Lusaka (ID = Lusaka@4@24 )

6.2.0.2 Empty units

Figure 6.49: Empty site in Lusaka (ID = Lusaka@1@17 )

Empty site in Lusaka (ID = Lusaka@1@17 )

Figure 6.50: Empty site in Lusaka (ID = Lusaka@2@8 )

Empty site in Lusaka (ID = Lusaka@2@8 )

Figure 6.51: Empty site in Lusaka (ID = Lusaka@2@17 )

Empty site in Lusaka (ID = Lusaka@2@17 )

Figure 6.52: Empty site in Lusaka (ID = Lusaka@3@3 )

Empty site in Lusaka (ID = Lusaka@3@3 )

Figure 6.53: Empty site in Lusaka (ID = Lusaka@3@11 )

Empty site in Lusaka (ID = Lusaka@3@11 )

Figure 6.54: Empty site in Lusaka (ID = Lusaka@3@14 )

Empty site in Lusaka (ID = Lusaka@3@14 )

Figure 6.55: Empty site in Lusaka (ID = Lusaka@3@16 )

Empty site in Lusaka (ID = Lusaka@3@16 )

Figure 6.56: Empty site in Lusaka (ID = Lusaka@4@17 )

Empty site in Lusaka (ID = Lusaka@4@17 )

Figure 6.57: Empty site in Lusaka (ID = Lusaka@5@2 )

Empty site in Lusaka (ID = Lusaka@5@2 )

Figure 6.58: Empty site in Lusaka (ID = Lusaka@5@3 )

Empty site in Lusaka (ID = Lusaka@5@3 )

Figure 6.59: Empty site in Lusaka (ID = Lusaka@6@2 )

Empty site in Lusaka (ID = Lusaka@6@2 )

Figure 6.60: Empty site in Lusaka (ID = Lusaka@6@3 )

Empty site in Lusaka (ID = Lusaka@6@3 )

Figure 6.61: Empty site in Lusaka (ID = Lusaka@7@2 )

Empty site in Lusaka (ID = Lusaka@7@2 )

Figure 6.62: Empty site in Lusaka (ID = Lusaka@7@3 )

Empty site in Lusaka (ID = Lusaka@7@3 )

Figure 6.63: Empty site in Lusaka (ID = Lusaka@7@5 )

Empty site in Lusaka (ID = Lusaka@7@5 )

Figure 6.64: Empty site in Lusaka (ID = Lusaka@7@7 )

Empty site in Lusaka (ID = Lusaka@7@7 )

Figure 6.65: Empty site in Lusaka (ID = Lusaka@8@1 )

Empty site in Lusaka (ID = Lusaka@8@1 )

Figure 6.66: Empty site in Lusaka (ID = Lusaka@8@3 )

Empty site in Lusaka (ID = Lusaka@8@3 )

6.2.0.3 Almost empty units

Figure 6.67: Almost empty site Lusaka (ID = Lusaka@2@3 )

Almost empty site Lusaka (ID = Lusaka@2@3 )

Figure 6.68: Almost empty site Lusaka (ID = Lusaka@2@14 )

Almost empty site Lusaka (ID = Lusaka@2@14 )

Figure 6.69: Almost empty site Lusaka (ID = Lusaka@2@16 )

Almost empty site Lusaka (ID = Lusaka@2@16 )

Figure 6.70: Almost empty site Lusaka (ID = Lusaka@2@34 )

Almost empty site Lusaka (ID = Lusaka@2@34 )

Figure 6.71: Almost empty site Lusaka (ID = Lusaka@2@40 )

Almost empty site Lusaka (ID = Lusaka@2@40 )

Figure 6.72: Almost empty site Lusaka (ID = Lusaka@3@25 )

Almost empty site Lusaka (ID = Lusaka@3@25 )

Figure 6.73: Almost empty site Lusaka (ID = Lusaka@3@27 )

Almost empty site Lusaka (ID = Lusaka@3@27 )

Figure 6.74: Almost empty site Lusaka (ID = Lusaka@4@3 )

Almost empty site Lusaka (ID = Lusaka@4@3 )

Figure 6.75: Almost empty site Lusaka (ID = Lusaka@4@4 )

Almost empty site Lusaka (ID = Lusaka@4@4 )

Figure 6.76: Almost empty site Lusaka (ID = Lusaka@4@8 )

Almost empty site Lusaka (ID = Lusaka@4@8 )

Figure 6.77: Almost empty site Lusaka (ID = Lusaka@4@9 )

Almost empty site Lusaka (ID = Lusaka@4@9 )

Figure 6.78: Almost empty site Lusaka (ID = Lusaka@4@13 )

Almost empty site Lusaka (ID = Lusaka@4@13 )

Figure 6.79: Almost empty site Lusaka (ID = Lusaka@4@16 )

Almost empty site Lusaka (ID = Lusaka@4@16 )

Figure 6.80: Almost empty site Lusaka (ID = Lusaka@4@22 )

Almost empty site Lusaka (ID = Lusaka@4@22 )

Figure 6.81: Almost empty site Lusaka (ID = Lusaka@5@1 )

Almost empty site Lusaka (ID = Lusaka@5@1 )

Figure 6.82: Almost empty site Lusaka (ID = Lusaka@5@4 )

Almost empty site Lusaka (ID = Lusaka@5@4 )

Figure 6.83: Almost empty site Lusaka (ID = Lusaka@6@4 )

Almost empty site Lusaka (ID = Lusaka@6@4 )

Figure 6.84: Almost empty site Lusaka (ID = Lusaka@6@7 )

Almost empty site Lusaka (ID = Lusaka@6@7 )

Figure 6.85: Almost empty site Lusaka (ID = Lusaka@7@4 )

Almost empty site Lusaka (ID = Lusaka@7@4 )

Figure 6.86: Almost empty site Lusaka (ID = Lusaka@7@6 )

Almost empty site Lusaka (ID = Lusaka@7@6 )

Figure 6.87: Almost empty site Lusaka (ID = Lusaka@8@2 )

Almost empty site Lusaka (ID = Lusaka@8@2 )

Figure 6.88: Almost empty site Lusaka (ID = Lusaka@8@4 )

Almost empty site Lusaka (ID = Lusaka@8@4 )
make_pic_loop(type = "replaced",
              data = lusaka_replacement_units,
              sp_obj = lusaka_1k_sample_complete,
              addition = "Lusaka")

6.2.1 Replacement units

Figure 6.89: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@1@25 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@1@25 )

Figure 6.90: Replacement units (ID = Lusaka@1@26 )

Replacement units (ID = Lusaka@1@26 )

Figure 6.91: Replacement units (ID = Lusaka@1@27 )

Replacement units (ID = Lusaka@1@27 )

Figure 6.92: Replacement units (ID = Lusaka@1@30 )

Replacement units (ID = Lusaka@1@30 )

Figure 6.93: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@1@31 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@1@31 )

Figure 6.94: Replacement units (ID = Lusaka@1@32 )

Replacement units (ID = Lusaka@1@32 )

Figure 6.95: Replacement units (ID = Lusaka@2@46 )

Replacement units (ID = Lusaka@2@46 )

Figure 6.96: Replacement units (ID = Lusaka@2@47 )

Replacement units (ID = Lusaka@2@47 )

Figure 6.97: Replacement units (ID = Lusaka@2@48 )

Replacement units (ID = Lusaka@2@48 )

Figure 6.98: Replacement units (ID = Lusaka@2@49 )

Replacement units (ID = Lusaka@2@49 )

Figure 6.99: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@2@50 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@2@50 )

Figure 6.100: Replacement units (ID = Lusaka@2@51 )

Replacement units (ID = Lusaka@2@51 )

Figure 6.101: Replacement units (ID = Lusaka@2@52 )

Replacement units (ID = Lusaka@2@52 )

Figure 6.102: Replacement units (ID = Lusaka@2@53 )

Replacement units (ID = Lusaka@2@53 )

Figure 6.103: Replacement units (ID = Lusaka@2@54 )

Replacement units (ID = Lusaka@2@54 )

Figure 6.104: Replacement units (ID = Lusaka@3@34 )

Replacement units (ID = Lusaka@3@34 )

Figure 6.105: Replacement units (ID = Lusaka@3@35 )

Replacement units (ID = Lusaka@3@35 )

Figure 6.106: Replacement units (ID = Lusaka@3@36 )

Replacement units (ID = Lusaka@3@36 )

Figure 6.107: Replacement units (ID = Lusaka@3@37 )

Replacement units (ID = Lusaka@3@37 )

Figure 6.108: Replacement units (ID = Lusaka@3@38 )

Replacement units (ID = Lusaka@3@38 )

Figure 6.109: Replacement units (ID = Lusaka@3@39 )

Replacement units (ID = Lusaka@3@39 )

Figure 6.110: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@3@40 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@3@40 )

Figure 6.111: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@3@41 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@3@41 )

Figure 6.112: Replacement units (ID = Lusaka@3@42 )

Replacement units (ID = Lusaka@3@42 )

Figure 6.113: Replacement units (ID = Lusaka@3@44 )

Replacement units (ID = Lusaka@3@44 )

Figure 6.114: Replacement units (ID = Lusaka@4@26 )

Replacement units (ID = Lusaka@4@26 )

Figure 6.115: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@27 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@27 )

Figure 6.116: Replacement units (ID = Lusaka@4@28 )

Replacement units (ID = Lusaka@4@28 )

Figure 6.117: Replacement units (ID = Lusaka@4@29 )

Replacement units (ID = Lusaka@4@29 )

Figure 6.118: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@30 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@30 )

Figure 6.119: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@31 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@31 )

Figure 6.120: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@32 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@32 )

Figure 6.121: Replacement units (ID = Lusaka@4@33 )

Replacement units (ID = Lusaka@4@33 )

Figure 6.122: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@34 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@4@34 )

Figure 6.123: Replacement units (ID = Lusaka@4@35 )

Replacement units (ID = Lusaka@4@35 )

Figure 6.124: Replacement units (ID = Lusaka@4@36 )

Replacement units (ID = Lusaka@4@36 )

Figure 6.125: Replacement units (ID = Lusaka@4@37 )

Replacement units (ID = Lusaka@4@37 )

Figure 6.126: Replacement units (ID = Lusaka@4@38 )

Replacement units (ID = Lusaka@4@38 )

Figure 6.127: Replacement units (ID = Lusaka@4@39 )

Replacement units (ID = Lusaka@4@39 )

Figure 6.128: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@5 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@5 )

Figure 6.129: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@7 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@7 )

Figure 6.130: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@8 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@8 )

Figure 6.131: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@9 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@9 )

Figure 6.132: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@10 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@10 )

Figure 6.133: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@11 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@11 )

Figure 6.134: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@12 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@12 )

Figure 6.135: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@13 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@13 )

Figure 6.136: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@18 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@18 )

Figure 6.137: Replacement units (ID = Lusaka@5@20 )

Replacement units (ID = Lusaka@5@20 )

Figure 6.138: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@21 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@21 )

Figure 6.139: Replacement units (ID = Lusaka@5@22 )

Replacement units (ID = Lusaka@5@22 )

Figure 6.140: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@23 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@23 )

Figure 6.141: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@24 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@24 )

Figure 6.142: Replacement units (ID = Lusaka@5@26 )

Replacement units (ID = Lusaka@5@26 )

Figure 6.143: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@31 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@31 )

Figure 6.144: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@32 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@32 )

Figure 6.145: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@33 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@33 )

Figure 6.146: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@37 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@37 )

Figure 6.147: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@38 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@38 )

Figure 6.148: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@41 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@41 )

Figure 6.149: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@42 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@42 )

Figure 6.150: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@43 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@43 )

Figure 6.151: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@44 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@44 )

Figure 6.152: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@45 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@45 )

Figure 6.153: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@47 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@47 )

Figure 6.154: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@48 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@5@48 )

Figure 6.155: Replacement units (ID = Lusaka@5@49 )

Replacement units (ID = Lusaka@5@49 )

Figure 6.156: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@9 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@9 )

Figure 6.157: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@10 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@10 )

Figure 6.158: Replacement units (ID = Lusaka@6@12 )

Replacement units (ID = Lusaka@6@12 )

Figure 6.159: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@13 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@13 )

Figure 6.160: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@15 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@15 )

Figure 6.161: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@16 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@16 )

Figure 6.162: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@18 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@18 )

Figure 6.163: Replacement units (ID = Lusaka@6@20 )

Replacement units (ID = Lusaka@6@20 )

Figure 6.164: Replacement units (ID = Lusaka@6@21 )

Replacement units (ID = Lusaka@6@21 )

Figure 6.165: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@23 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@23 )

Figure 6.166: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@24 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@24 )

Figure 6.167: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@25 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@25 )

Figure 6.168: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@26 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@6@26 )

Figure 6.169: Replacement units (ID = Lusaka@6@28 )

Replacement units (ID = Lusaka@6@28 )

Figure 6.170: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@8 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@8 )

Figure 6.171: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@9 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@9 )

Figure 6.172: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@10 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@10 )

Figure 6.173: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@11 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@11 )

Figure 6.174: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@12 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@12 )

Figure 6.175: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@15 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@15 )

Figure 6.176: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@23 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@23 )

Figure 6.177: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@24 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@24 )

Figure 6.178: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@25 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@25 )

Figure 6.179: Replacement units (ID = Lusaka@7@26 )

Replacement units (ID = Lusaka@7@26 )

Figure 6.180: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@28 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@28 )

Figure 6.181: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@29 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@29 )

Figure 6.182: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@30 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@30 )

Figure 6.183: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@32 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@32 )

Figure 6.184: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@33 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@33 )

Figure 6.185: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@36 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@36 )

Figure 6.186: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@38 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@38 )

Figure 6.187: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@39 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@39 )

Figure 6.188: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@42 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@42 )

Figure 6.189: Replacement units (ID = Lusaka@7@45 )

Replacement units (ID = Lusaka@7@45 )

Figure 6.190: Replacement units (ID = Lusaka@7@47 )

Replacement units (ID = Lusaka@7@47 )

Figure 6.191: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@48 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@48 )

Figure 6.192: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@49 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@49 )

Figure 6.193: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@52 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@52 )

Figure 6.194: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@53 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@53 )

Figure 6.195: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@54 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@54 )

Figure 6.196: Replacement units (ID = Lusaka@7@55 )

Replacement units (ID = Lusaka@7@55 )

Figure 6.197: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@56 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@56 )

Figure 6.198: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@58 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@58 )

Figure 6.199: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@59 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@59 )

Figure 6.200: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@62 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@62 )

Figure 6.201: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@66 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@66 )

Figure 6.202: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@68 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@68 )

Figure 6.203: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@70 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@70 )

Figure 6.204: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@71 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@71 )

Figure 6.205: Replacement units (ID = Lusaka@7@73 )

Replacement units (ID = Lusaka@7@73 )

Figure 6.206: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@76 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@76 )

Figure 6.207: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@77 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@77 )

Figure 6.208: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@79 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@7@79 )

Figure 6.209: Replacement units (ID = Lusaka@7@80 )

Replacement units (ID = Lusaka@7@80 )

Figure 6.210: Replacement units (ID = Lusaka@8@7 )

Replacement units (ID = Lusaka@8@7 )

Figure 6.211: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@8 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@8 )

Figure 6.212: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@9 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@9 )

Figure 6.213: Replacement units (ID = Lusaka@8@10 )

Replacement units (ID = Lusaka@8@10 )

Figure 6.214: Replacement units (ID = Lusaka@8@12 )

Replacement units (ID = Lusaka@8@12 )

Figure 6.215: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@15 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@15 )

Figure 6.216: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@17 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@17 )

Figure 6.217: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@19 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lusaka@8@19 )

Figure 6.218: Replacement units (ID = Lusaka@8@20 )

Replacement units (ID = Lusaka@8@20 )
zambia_fdgs <- readKML("data/fdgs/Zambia Northern Eastern FGD Locations.kml") %>%
  as("SpatialPoints")
## OGR data source with driver: KML 
## Source: "D:\Users\senic\Dropbox\Projects\GLD sampling methods\master_1\sampling_documentation\data\fdgs\Zambia Northern Eastern FGD Locations.kml", layer: "Northern___Eastern_FGD_Locations"
## with 9 features
## It has 2 fields
if (over(lusaka_1k_sample_complete,zambia_fdgs) %>% 
  is.na %>% 
  `!` %>% 
  which() %>% 
  length() == 0) cat("No overlap between sample and FDGs.")
## No overlap between sample and FDGs.

6.3 Lilongwe

Table 6.3: Lilongwe: Number of units that need to be resampled from each bin.

Bin Frequency
1 2
2 6
3 1
4 2
5 6
6 8
7 7
8 7
sapply(lilongwe_replaced_id$Type %>% 
         unique,make_pic_loop,
              data = lilongwe_replaced_id,
              sp_obj = lilongwe_sample_150,
       addition = "Lilongwe")

6.3.0.1 Industry

Figure 6.219: Industrial site in Lilongwe (ID = Lilongwe@1@11 )

Industrial site in Lilongwe (ID = Lilongwe@1@11 )

Figure 6.220: Industrial site in Lilongwe (ID = Lilongwe@3@25 )

Industrial site in Lilongwe (ID = Lilongwe@3@25 )

6.3.0.2 Empty units

Figure 6.221: Empty site in Lilongwe (ID = Lilongwe@1@17 )

Empty site in Lilongwe (ID = Lilongwe@1@17 )

Figure 6.222: Empty site in Lilongwe (ID = Lilongwe@2@3 )

Empty site in Lilongwe (ID = Lilongwe@2@3 )

Figure 6.223: Empty site in Lilongwe (ID = Lilongwe@2@8 )

Empty site in Lilongwe (ID = Lilongwe@2@8 )

Figure 6.224: Empty site in Lilongwe (ID = Lilongwe@2@11 )

Empty site in Lilongwe (ID = Lilongwe@2@11 )

Figure 6.225: Empty site in Lilongwe (ID = Lilongwe@2@16 )

Empty site in Lilongwe (ID = Lilongwe@2@16 )

Figure 6.226: Empty site in Lilongwe (ID = Lilongwe@4@11 )

Empty site in Lilongwe (ID = Lilongwe@4@11 )

Figure 6.227: Empty site in Lilongwe (ID = Lilongwe@5@3 )

Empty site in Lilongwe (ID = Lilongwe@5@3 )

Figure 6.228: Empty site in Lilongwe (ID = Lilongwe@5@14 )

Empty site in Lilongwe (ID = Lilongwe@5@14 )

Figure 6.229: Empty site in Lilongwe (ID = Lilongwe@5@16 )

Empty site in Lilongwe (ID = Lilongwe@5@16 )

Figure 6.230: Empty site in Lilongwe (ID = Lilongwe@5@17 )

Empty site in Lilongwe (ID = Lilongwe@5@17 )

Figure 6.231: Empty site in Lilongwe (ID = Lilongwe@6@8 )

Empty site in Lilongwe (ID = Lilongwe@6@8 )

Figure 6.232: Empty site in Lilongwe (ID = Lilongwe@6@11 )

Empty site in Lilongwe (ID = Lilongwe@6@11 )

Figure 6.233: Empty site in Lilongwe (ID = Lilongwe@6@14 )

Empty site in Lilongwe (ID = Lilongwe@6@14 )

Figure 6.234: Empty site in Lilongwe (ID = Lilongwe@6@18 )

Empty site in Lilongwe (ID = Lilongwe@6@18 )

Figure 6.235: Empty site in Lilongwe (ID = Lilongwe@7@8 )

Empty site in Lilongwe (ID = Lilongwe@7@8 )

Figure 6.236: Empty site in Lilongwe (ID = Lilongwe@7@16 )

Empty site in Lilongwe (ID = Lilongwe@7@16 )

Figure 6.237: Empty site in Lilongwe (ID = Lilongwe@7@17 )

Empty site in Lilongwe (ID = Lilongwe@7@17 )

Figure 6.238: Empty site in Lilongwe (ID = Lilongwe@8@11 )

Empty site in Lilongwe (ID = Lilongwe@8@11 )

Figure 6.239: Empty site in Lilongwe (ID = Lilongwe@8@17 )

Empty site in Lilongwe (ID = Lilongwe@8@17 )

6.3.0.3 Almost empty units

Figure 6.240: Almost empty site Lilongwe (ID = Lilongwe@2@2 )

Almost empty site Lilongwe (ID = Lilongwe@2@2 )

Figure 6.241: Almost empty site Lilongwe (ID = Lilongwe@2@9 )

Almost empty site Lilongwe (ID = Lilongwe@2@9 )

Figure 6.242: Almost empty site Lilongwe (ID = Lilongwe@4@3 )

Almost empty site Lilongwe (ID = Lilongwe@4@3 )

Figure 6.243: Almost empty site Lilongwe (ID = Lilongwe@5@8 )

Almost empty site Lilongwe (ID = Lilongwe@5@8 )

Figure 6.244: Almost empty site Lilongwe (ID = Lilongwe@5@15 )

Almost empty site Lilongwe (ID = Lilongwe@5@15 )

Figure 6.245: Almost empty site Lilongwe (ID = Lilongwe@6@4 )

Almost empty site Lilongwe (ID = Lilongwe@6@4 )

Figure 6.246: Almost empty site Lilongwe (ID = Lilongwe@6@16 )

Almost empty site Lilongwe (ID = Lilongwe@6@16 )

Figure 6.247: Almost empty site Lilongwe (ID = Lilongwe@6@17 )

Almost empty site Lilongwe (ID = Lilongwe@6@17 )

Figure 6.248: Almost empty site Lilongwe (ID = Lilongwe@6@22 )

Almost empty site Lilongwe (ID = Lilongwe@6@22 )

Figure 6.249: Almost empty site Lilongwe (ID = Lilongwe@7@2 )

Almost empty site Lilongwe (ID = Lilongwe@7@2 )

Figure 6.250: Almost empty site Lilongwe (ID = Lilongwe@7@3 )

Almost empty site Lilongwe (ID = Lilongwe@7@3 )

Figure 6.251: Almost empty site Lilongwe (ID = Lilongwe@7@7 )

Almost empty site Lilongwe (ID = Lilongwe@7@7 )

Figure 6.252: Almost empty site Lilongwe (ID = Lilongwe@7@11 )

Almost empty site Lilongwe (ID = Lilongwe@7@11 )

Figure 6.253: Almost empty site Lilongwe (ID = Lilongwe@8@2 )

Almost empty site Lilongwe (ID = Lilongwe@8@2 )

Figure 6.254: Almost empty site Lilongwe (ID = Lilongwe@8@3 )

Almost empty site Lilongwe (ID = Lilongwe@8@3 )

Figure 6.255: Almost empty site Lilongwe (ID = Lilongwe@8@13 )

Almost empty site Lilongwe (ID = Lilongwe@8@13 )

Figure 6.256: Almost empty site Lilongwe (ID = Lilongwe@8@15 )

Almost empty site Lilongwe (ID = Lilongwe@8@15 )

Figure 6.257: Almost empty site Lilongwe (ID = Lilongwe@8@16 )

Almost empty site Lilongwe (ID = Lilongwe@8@16 )
make_pic_loop(type = "replaced",
              data = lilongwe_replacement_units,
              sp_obj = lilongwe_1k_sample_complete,
              addition = "Lilongwe")

6.3.1 Replacement units

Figure 6.258: Replacement units (ID = Lilongwe@1@19 )

Replacement units (ID = Lilongwe@1@19 )

Figure 6.259: Replacement units (ID = Lilongwe@1@20 )

Replacement units (ID = Lilongwe@1@20 )

Figure 6.260: Replacement units (ID = Lilongwe@2@18 )

Replacement units (ID = Lilongwe@2@18 )

Figure 6.261: Replacement units (ID = Lilongwe@2@19 )

Replacement units (ID = Lilongwe@2@19 )

Figure 6.262: Replacement units (ID = Lilongwe@2@20 )

Replacement units (ID = Lilongwe@2@20 )

Figure 6.263: Replacement units (ID = Lilongwe@2@21 )

Replacement units (ID = Lilongwe@2@21 )

Figure 6.264: Replacement units (ID = Lilongwe@2@22 )

Replacement units (ID = Lilongwe@2@22 )

Figure 6.265: Replacement units (ID = Lilongwe@2@23 )

Replacement units (ID = Lilongwe@2@23 )

Figure 6.266: Replacement units (ID = Lilongwe@3@27 )

Replacement units (ID = Lilongwe@3@27 )

Figure 6.267: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@4@14 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@4@14 )

Figure 6.268: Replacement units (ID = Lilongwe@4@15 )

Replacement units (ID = Lilongwe@4@15 )

Figure 6.269: Replacement units (ID = Lilongwe@4@16 )

Replacement units (ID = Lilongwe@4@16 )

Figure 6.270: Replacement units (ID = Lilongwe@5@21 )

Replacement units (ID = Lilongwe@5@21 )

Figure 6.271: Replacement units (ID = Lilongwe@5@23 )

Replacement units (ID = Lilongwe@5@23 )

Figure 6.272: Replacement units (ID = Lilongwe@5@26 )

Replacement units (ID = Lilongwe@5@26 )

Figure 6.273: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@5@27 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@5@27 )

Figure 6.274: Replacement units (ID = Lilongwe@5@28 )

Replacement units (ID = Lilongwe@5@28 )

Figure 6.275: Replacement units (ID = Lilongwe@5@29 )

Replacement units (ID = Lilongwe@5@29 )

Figure 6.276: Replacement units (ID = Lilongwe@5@30 )

Replacement units (ID = Lilongwe@5@30 )

Figure 6.277: Replacement units (ID = Lilongwe@6@23 )

Replacement units (ID = Lilongwe@6@23 )

Figure 6.278: Replacement units (ID = Lilongwe@6@26 )

Replacement units (ID = Lilongwe@6@26 )

Figure 6.279: Replacement units (ID = Lilongwe@6@28 )

Replacement units (ID = Lilongwe@6@28 )

Figure 6.280: Replacement units (ID = Lilongwe@6@29 )

Replacement units (ID = Lilongwe@6@29 )

Figure 6.281: Replacement units (ID = Lilongwe@6@30 )

Replacement units (ID = Lilongwe@6@30 )

Figure 6.282: Replacement units (ID = Lilongwe@6@32 )

Replacement units (ID = Lilongwe@6@32 )

Figure 6.283: Replacement units (ID = Lilongwe@6@33 )

Replacement units (ID = Lilongwe@6@33 )

Figure 6.284: Replacement units (ID = Lilongwe@6@34 )

Replacement units (ID = Lilongwe@6@34 )

Figure 6.285: Replacement units (ID = Lilongwe@7@19 )

Replacement units (ID = Lilongwe@7@19 )

Figure 6.286: Replacement units (ID = Lilongwe@7@20 )

Replacement units (ID = Lilongwe@7@20 )

Figure 6.287: Replacement units (ID = Lilongwe@7@21 )

Replacement units (ID = Lilongwe@7@21 )

Figure 6.288: Replacement units (ID = Lilongwe@7@22 )

Replacement units (ID = Lilongwe@7@22 )

Figure 6.289: Replacement units (ID = Lilongwe@7@23 )

Replacement units (ID = Lilongwe@7@23 )

Figure 6.290: Replacement units (ID = Lilongwe@7@24 )

Replacement units (ID = Lilongwe@7@24 )

Figure 6.291: Replacement units (ID = Lilongwe@7@26 )

Replacement units (ID = Lilongwe@7@26 )

Figure 6.292: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@8@18 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@8@18 )

Figure 6.293: Replacement units (ID = Lilongwe@8@19 )

Replacement units (ID = Lilongwe@8@19 )

Figure 6.294: Replacement units (ID = Lilongwe@8@20 )

Replacement units (ID = Lilongwe@8@20 )

Figure 6.295: Replacement units (ID = Lilongwe@8@21 )

Replacement units (ID = Lilongwe@8@21 )

Figure 6.296: Replacement units (ID = Lilongwe@8@22 )

Replacement units (ID = Lilongwe@8@22 )

Figure 6.297: Replacement units (ID = Lilongwe@8@23 )

Replacement units (ID = Lilongwe@8@23 )

Figure 6.298: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@8@24 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@8@24 )

Figure 6.299: Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@8@25 )

Replacement units (Unit is almost empty, and a replacement unit is drawn.) (ID = Lilongwe@8@25 )

Figure 6.300: Replacement units (ID = Lilongwe@8@26 )

Replacement units (ID = Lilongwe@8@26 )

Figure 6.301: Replacement units (ID = Lilongwe@8@27 )

Replacement units (ID = Lilongwe@8@27 )
# 
malawi_fdgs <- read.csv("data/fdgs/GLD_FDGs_GPS Recordings.csv") %>% head %>% 
  dplyr::select(gps.Longitude,gps.Latitude) %>% 
  SpatialPoints(proj4string = CRS(proj4string(lilongwe_1k_sample_complete)))
# 
# 
if (over(lilongwe_1k_sample_complete[lilongwe_1k_sample_complete$type=="Unit_2",],malawi_fdgs) %>%
  is.na %>%
  `!` %>%
  which() %>%
  length() == 0) cat("No overlap between sample and FDGs.")
## No overlap between sample and FDGs.

6.4 Zambia

zam_check <- readLines("output/zambia_check.txt",warn=FALSE)
zam_check <- zam_check[zam_check!=""]
zambia_checking <- zam_check %>% 
  strsplit(" ") %>% 
  lapply(function(x) {
    if (length(x)==1) return(data.frame(ID=x[1],Full="Full"))
    if (x[2]=="a") return(data.frame(ID=x[1],Full="Almost Full"))
    return(NULL)
  }) %>% 
  do.call(rbind,.)

zambia_checking$unit3 <- zambia_checking[,1] %>% 
  strsplit("@") %>% 
  lapply(function(x) paste(x[1],x[2],x[3],sep="@")) %>% 
  unlist()

to_be_replaced <- zambia_checking %>% 
  filter(Full=="Full") %>% 
  group_by(unit3) %>% 
  summarise(Full=n()) %>%
  filter(Full<2) 

empty_units <- zam_check[grepl("repl",zam_check)] %>% gsub(" repl","",.)

to_be_replaced <- data.frame(unit3=empty_units[!empty_units%in%to_be_replaced[,1]],
           Full=0)


to_be_replaced %>% 
  mutate(bin=strsplit(unit3,"@") %>% 
           lapply(function(x) paste(x[1],x[2],sep="@")) %>% 
                    unlist()) %>% 
  group_by(bin) %>% 
  summarise(n())
## # A tibble: 10 x 2
##    bin       `n()`
##    <chr>     <int>
##  1 Zambia@1      4
##  2 Zambia@10     4
##  3 Zambia@2      8
##  4 Zambia@3      6
##  5 Zambia@4      4
##  6 Zambia@5      6
##  7 Zambia@6      2
##  8 Zambia@7      5
##  9 Zambia@8      4
## 10 Zambia@9      4
replacements_1 <- readLines("output/zambia_replacement.txt",warn=FALSE)
replacements_1 <- replacements_1[replacements_1!=""]
replacements_2 <- replacements_1 %>% 
 strsplit(" ") %>% 
  lapply(function(x) {
    if (length(x)==1) return(data.frame(ID=x[1],Full="Full"))
    if (x[2]=="a") return(data.frame(ID=x[1],Full="Almost Full"))
    return(NULL)
  }) %>% 
  do.call(rbind,.) %>% 
  filter(Full=="Full")

replacements_2$unit3 <- replacements_2[,1] %>% 
  strsplit("@") %>% 
  lapply(function(x) paste(x[1],x[2],x[3],sep="@")) %>% 
  do.call(rbind,.)


replacements_3 <- replacements_2 %>% 
  group_by(unit3) %>% 
  summarise(Full=n()) %>% 
  filter(Full>1)


replacements_3 %>% 
  mutate(bin=strsplit(unit3,"@") %>% 
           lapply(function(x) paste(x[1],x[2],sep="@")) %>% 
                    unlist()) %>% 
  group_by(bin) %>% 
  summarise(n())
## # A tibble: 10 x 2
##    bin       `n()`
##    <chr>     <int>
##  1 Zambia@1      4
##  2 Zambia@10     4
##  3 Zambia@2      8
##  4 Zambia@3      6
##  5 Zambia@4      4
##  6 Zambia@5      6
##  7 Zambia@6      2
##  8 Zambia@7      5
##  9 Zambia@8      4
## 10 Zambia@9      4
zambia_replacement_units <- readLines(
  "output/zambia_replacement.txt",warn=FALSE) %>% 
  strsplit("\n") %>% 
  unlist() %>%
  strsplit(" ") %>% 
  lapply(function(x) {
    if (length(x)==1) return(data.frame(ID=x[1],Full="Full"))
    if (x[2]=="a") return(data.frame(ID=x[1],Full="Almost Empty"))
    return(NULL)
  }) %>% 
  do.call(rbind,.) %>% 
  mutate(bin = sapply(ID,function(x) {
    strsplit(x,"@") %>% 
      lapply(function(y) paste(y[1],y[2],sep="@")) %>% 
      unlist()}),
    unit3 = sapply(ID,function(x) {
    strsplit(x,"@") %>% 
      lapply(function(y) paste(y[1],y[2],y[3],sep="@")) %>% 
      unlist()
  }))
  

zambia_sample_200_complete <- 
  bind(zambia_sample_200[zambia_sample_200$pick=="Sample"&
                           (zambia_sample_200$Name%in%
                              c(zambia_checking$ID,
                                zambia_checking$unit3)|
                              zambia_sample_200$type=="Bin"),],
       zambia_sample_200[zambia_sample_200$pick!="Sample"&
                           zambia_sample_200$Name%in%
                           c(zambia_replacement_units$ID,
                             zambia_replacement_units$bin,
                             zambia_replacement_units$unit3),])

zambia_sample_200_complete$almost_empty <- "Full"
zambia_sample_200_complete$almost_empty[
  zambia_sample_200_complete$Name%in%
    c(zambia_checking$ID[zambia_checking$Full == "Almost Full"],
      zambia_replacement_units$ID[zambia_replacement_units$Full=="Almost Empty"])] <- 
  "Almost Empty"


zambia_sample_200_complete$Description <- 
  paste0(zambia_sample_200_complete$Description,"; Replacement Status: ",
         zambia_sample_200_complete$almost_empty)

zambia_sample_200_complete <- 
  zambia_sample_200_complete[order(zambia_sample_200_complete$Name),]


overl <- over(zambia_sample_200_complete[zambia_sample_200_complete$type=="Unit_2",],
     zambia_fdgs) %>% 
  is.na %>% 
  `!` %>% 
  which() %>% sapply(function(x) 
    zambia_sample_200_complete$Name[
  which(zambia_sample_200_complete$type=="Unit_2")[x]])

zambia_5k_1k_sample_200_complete <-
  zambia_sample_200_complete[!zambia_sample_200_complete$Name%in%overl,]

writeOGR(zambia_5k_1k_sample_200_complete,
         "output/zambia_5k_1k_sample_200_complete",
         driver = "KML",
         layer = "zambia",overwrite_layer = TRUE)
## Warning in fld_names == attr(res, "ofld_nms"): longer object length is not
## a multiple of shorter object length
##    Bin Sampled To Sample
## 1    1       9        10
## 2    2      12        12
## 3    3      12        12
## 4    4       9         9
## 5    5      24        23
## 6    6       6         6
## 7    7       7         7
## 8    8       4         4
## 9    9       7         7
## 10  10      10        10
##   Bin Sampled To Sample
## 1   1      18        18
## 2   2      16        16
## 3   3      26        26
## 4   4      13        13
## 5   5      20        20
## 6   6      22        22
## 7   7      18        18
## 8   8      17        17
##   Bin Sampled To Sample
## 1   1      24        24
## 2   2      45        45
## 3   3      33        33
## 4   4      24        24
## 5   5       4         4
## 6   6       7         7
## 7   7       7         7
## 8   8       6         6
##   Bin Sampled To Sample
## 1   1      17        17
## 2   2      46        46
## 3   3      22        22
## 4   4      24        23
## 5   5      10        10
## 6   6      22        22
## 7   7       9         8
## 8   8       2         2

6.5 Malawi

maw_check <- readLines("output/malawi_check.txt",warn=FALSE)
maw_check <- maw_check[maw_check!=""]
malawi_checking <- maw_check %>% 
  strsplit(" ") %>% 
  lapply(function(x) {
    if (length(x)==1) return(data.frame(ID=x[1],Full="Full"))
    if (x[2]=="a") return(data.frame(ID=x[1],Full="Almost Full"))
    return(NULL)
  }) %>% 
  do.call(rbind,.)

malawi_checking$unit3 <- malawi_checking[,1] %>% 
  strsplit("@") %>% 
  lapply(function(x) paste(x[1],x[2],x[3],sep="@")) %>% 
  unlist()

malawi_checking$unit2 <- malawi_checking[,1] %>% 
  strsplit("@") %>% 
  lapply(function(x) paste(x[1],x[2],sep="@")) %>% 
  unlist()
  

maw_to_be_replaced <- malawi_checking %>% 
  filter(Full=="Full") %>% 
  group_by(unit3) %>% 
  summarise(Full=n()) %>%
  filter(Full<2) 

empty_units <- maw_check[grepl("repl",maw_check)] %>% gsub(" repl","",.)
# no units to replace
# zambia_replacement_units <- readLines(
#   "output/zambia_replacement.txt",warn=FALSE) %>% 
#   strsplit("\n") %>% 
#   unlist() %>%
#   strsplit(" ") %>% 
#   lapply(function(x) {
#     if (length(x)==1) return(data.frame(ID=x[1],Full="Full"))
#     if (x[2]=="a") return(data.frame(ID=x[1],Full="Almost Empty"))
#     return(NULL)
#   }) %>% 
#   do.call(rbind,.) %>% 
#   mutate(bin = sapply(ID,function(x) {
#     strsplit(x,"@") %>% 
#       lapply(function(y) paste(y[1],y[2],sep="@")) %>% 
#       unlist()}),
#     unit3 = sapply(ID,function(x) {
#     strsplit(x,"@") %>% 
#       lapply(function(y) paste(y[1],y[2],y[3],sep="@")) %>% 
#       unlist()
#   }))
  

malawi_sample_200_complete <- 
  malawi_sample_200[malawi_sample_200$pick=="Sample"&
                      (malawi_sample_200$Name%in%
                         c(malawi_checking$ID,
                           malawi_checking$unit3,
                           malawi_checking$unit2)|
                         malawi_sample_200$type=="Bin"),]

malawi_sample_200_complete$almost_empty <- "Full"
malawi_sample_200_complete$almost_empty[
  malawi_sample_200_complete$Name%in%
    malawi_checking$ID[malawi_checking$Full == "Almost Full"]] <- 
  "Almost Empty"


malawi_sample_200_complete$Description <- 
  paste0(malawi_sample_200_complete$Description,"; Replacement Status: ",
         malawi_sample_200_complete$almost_empty)

malawi_sample_200_complete <- 
  malawi_sample_200_complete[order(malawi_sample_200_complete$Name),]


if (over(malawi_sample_200_complete[malawi_sample_200_complete$type=="Unit_2",],malawi_fdgs) %>%
  is.na %>%
  `!` %>%
  which() %>%
  length() == 0) cat("No overlap between sample and FDGs.") else cat("There are units that overlap with the FDGs.")
## There are units that overlap with the FDGs.
overl <- over(malawi_sample_200_complete[malawi_sample_200_complete$type=="Unit_2",],
     malawi_fdgs) %>%
  is.na %>%
  `!` %>%
  which() %>% sapply(function(x)
    malawi_sample_200_complete$Name[
  which(malawi_sample_200_complete$type=="Unit_2")[x]])


# 
if (length(overl)>0) malawi_5k_1k_sample_200_complete <-
  malawi_sample_200_complete[!malawi_sample_200_complete$Name%in%overl,]

# 
overl
##          15195 
## "Malawi@7@6@2"
writeOGR(malawi_sample_200_complete,
         "output/malawi_5k_1k_sample_200_complete.kml",
         driver = "KML",
         layer = "malawi",overwrite_layer = TRUE)
## Warning in fld_names == attr(res, "ofld_nms"): longer object length is not
## a multiple of shorter object length