Table of Contents
- Necessary Imports
- Get the data for your analysis
- Create a 5-mile drive time polygon around the best performing community.
- Proximity analysis
- Determine the top tapestry segments.
- Enriching study areas
- Convert the top four target area tapestry counts to percentages
- Obtain the same data for the candidate ZIP Codes.
- Rank the candidate ZIP Codes by their similarity to the target area.
In the past, retirement communities in the United states were built in the suburbs, in warmest parts of the country. These days, however, people approaching retirement are not willing to relocate. They want to be connected to their friends and family, remain close to existng doctors and enjoy cultural and educational oportunites.
This sample demonstrates the utility of ArcGIS API for Python to identify some great locations for a new retirement community, which will satisfy these needs of senior citizens. It will demostrate the use tools such as
find_similar_locations, and editing field definitions and layer data.
First, we will look for locations that have large number of senior citizens but very few existing retirement communities. We will then rank these locations by comparing it to the most current successsful retirement community.
The LocatingRetirementCommunity Feature Layer Collection includes two layers. The first layer, called Target Community, contains the current best performing retirement community near Knoxville, Tennessee. The second layer, called Candidates, contains the 898 ZIP Codes in the continental USA associated with statistically significant hot or cold spot areas for all of these criteria:
- High demand for retirement housing opportunities
- Low supply of retirement housing
- Low housing unit vacancy rates
- Large projected age of 55 and older populations
Hot spot analysis to identify these candidate ZIP Codes was done using ArcMap. This analysis is included in both the ArcMap and ArcGIS Pro workflows.
In the workflow below, we will be using ArcGIS API for Python to create a 5-mile drive distance around the best performing community and obtaining tapestry and demographic data for the area. We will then obtain the same data for the candidate ZIP Codes. Finally, we will use the Find Similar Locations tool to identify the top four high demand, low vacancy, large projected age of 55+ population ZIP Codes that are most similar to the area surrounding the best performing community.
import pandas as pd from datetime import datetime as dt from arcgis.gis import GIS from arcgis.geoenrichment import * from arcgis.features.use_proximity import create_drive_time_areas from arcgis.features.enrich_data import enrich_layer from arcgis.features import FeatureLayerCollection from arcgis.features.find_locations import find_similar_locations
gis = GIS('home')
Search for the LocatingRetirementCommunity layer. You can specify the owner's name to get more specific results. To search for content from the Living Atlas, or content shared by other users on ArcGIS Online, set
items = gis.content.search('title: LocatingRetirementCommunity owner:api_data_owner', 'Feature layer', outside_org=True)
Display the list of results.
from IPython.display import display for item in items: display(item)
Since the first item is a Feature Layer Collection, accessing the layers property will give us a list of FeatureLayer objects.
lyrs = items.layers
for lyr in lyrs: print(lyr.properties.name)
target_community = lyrs candidates = lyrs
m1 = gis.map('Knoxville') m1