1 Introduction

A new IKEA store is going to be placed in the Boston area and this code uses predetermined parameters to create a map of the potential locations for the store. The potential locations must have a median income between 25,000 and 80,000 dollars and a household value between 200,000 and 500,000 dollars. Additionally, the store must be built on open lands, be within 2000 feet of major roads and be at least 200,000 square feet. Utilizing census data, land use information from MassGIS, and data on Boston’s major roads from the US Census Bureau, tidyverse functions are utilized to select potential locations. The locations are then mapped for visualization and analysis of the potential locations.

2 Load Packages

library(tidyverse)
library(sf)

3 Read spatial data

censustracts <- read_sf("/Users/lorigerstenfeld/Downloads/Lite_SDS/Lite_SDS/CS_07_spatial_case_study_data/Boston_CensusTracts.shp")
landuse <- read_sf("/Users/lorigerstenfeld/Downloads/Lite_SDS/Lite_SDS/CS_07_spatial_case_study_data/Boston_LandUse.shp")
majorroads <- read_sf("/Users/lorigerstenfeld/Downloads/Lite_SDS/Lite_SDS/CS_07_spatial_case_study_data/Boston_MajorRoads.shp")

4 Filter for desired data

4.1 Filter census data for desired median income level and home value

censustracts2 <- censustracts %>%
  filter(Med_Income>25000 & Med_Income<80000) %>%
  filter(Med_HouseV>200000 & Med_HouseV<500000)

4.2 Filter land use data for open land

landuse2 <- landuse %>%
  filter(LU05_DESC=='Open Land')

4.3 Create buffer zone for major roads

majorroads2 <- majorroads %>%
  st_buffer(2000)

4.4 Validity

4.4.1 Verify validity of datasets

sum(!st_is_valid(censustracts2))
## [1] 0
sum(!st_is_valid(landuse2))
## [1] 1
sum(!st_is_valid(majorroads2))
## [1] 0

From these results, we can see that all of the polygons in the census tracts and major roads data sets are valid, however there are 1 polygon in the land use data set is invalid.

4.4.2 Make invaild data valid

landuse3 <- st_make_valid(landuse2)

#check that it worked
sum(!st_is_valid(landuse3))
## [1] 0

Looks like it worked!

4.5 Find intersections of datasets

intersection <- st_intersection(censustracts2, landuse3, majorroads2) %>%
  st_union() %>%
  st_cast("POLYGON") %>%
  st_as_sf()

4.6 Calculate area

intersection$area <- as.numeric(st_area(intersection))

4.7 Select polygons of appropriate area

ikea <- intersection %>%
  dplyr::filter(area > 200000)

5 Create map

5.1 Exclude data from census tract map where people do not live (water and parks)

censustracts <- censustracts %>%
  filter(Med_Income>1)

5.2 Create plot (and save as png)

#open png
png("/Users/lorigerstenfeld/Downloads/ikeamap.png", 
    height=1500, 
    width=1500, 
    res=150)

#create map
ggplot()+
  geom_sf(data=censustracts, aes(fill=Med_Income)) + #mapping median income
  scale_fill_distiller(palette="BuPu", name="Median Income")+ 
  geom_sf(data=ikea, fill="red", aes(color="red"))+ #mapping potential sites
  scale_color_manual(values="red",
                     name="Potential IKEA Locations",
                     labels="Area of Locations Satisfying Requirements")+ #adding potential sites to legend
  labs(title="Potential IKEA Locations in Boston, MA",
       subtitle="Data from US Census Bureau and MassGIS",
       x="Latitude",
       y="Longitude") +
  theme_classic()+
  theme(plot.title = element_text(hjust=0.5, vjust=3),
        plot.subtitle=element_text(hjust=0.5, vjust=3)) #centering title and subtitle

#close png
dev.off()

5.3 Display final map

Figure 1: Potential Boston IKEA Locations

Figure 1: Potential Boston IKEA Locations

6 Conclusion

The completed analysis allowed for the identification of 20 potential locations for the new Boston IKEA store. As shown by figure 1, most of the potential locations are located in the northeast of Boston, with some in the southeast. Generally, the locations are concentrated in higher-income areas of Boston (colored purple in Figure 1), which verifies the accuracy of the data analysis, as one of the parameters for potential store location was a relatively high median household income. With this data, IKEA representatives can identify their ideal location for a store. They may want to consider the other stores surrounding these potential locations and gauge public interest to determine a final location for the new IKEA store.