13.7 Identifying suitable locations

The only steps that remain before combining all the layers are to add poi to the reclass raster stack and remove the population layer from it.The reasoning for the latter is twofold.First of all, we have already delineated metropolitan areas, that is areas where the population density is above average compared to the rest of Germany.Second, though it is advantageous to have many potential customers within a specific catchment area, the sheer number alone might not actually represent the desired target group.For instance, residential tower blocks are areas with a high population density but not necessarily with a high purchasing power for expensive cycle components.This is achieved with the complementary functions addLayer() and dropLayer():

  1. # add poi raster
  2. reclass = addLayer(reclass, poi)
  3. # delete population raster
  4. reclass = dropLayer(reclass, "pop")

In common with other data science projects, data retrieval and ‘tidying’ have consumed much of the overall workload so far.With clean data, the final step — calculating a final score by summing all raster layers — can be accomplished in a single line of code.

  1. # calculate the total score
  2. result = sum(reclass)

For instance, a score greater than 9 might be a suitable threshold indicating raster cells where a bike shop could be placed (Figure 13.3; see also code/13-location-jm.R).

Figure 13.3: Suitable areas (i.e., raster cells with a score > 9) in accordance with our hypothetical survey for bike stores in Berlin.