ArcGIS Developer

ArcGIS API for Python

Download the samples Try it live

Locating a new retirement community


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 create_drive_time_areas, enrich_layer, 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.


Necessary Imports

In [1]:
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

Get the data for your analysis

In [2]:
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 outside_org=True.

In [3]:
items ='title: LocatingRetirementCommunity owner:api_data_owner',
                           'Feature layer',

Display the list of results.

In [4]:
from IPython.display import display

for item in items:
Data to use with the Locating a New Retirement Community case study.Feature Layer Collection by api_data_owner
Last Modified: June 17, 2019
0 comments, 3 views

Since the first item is a Feature Layer Collection, accessing the layers property will give us a list of FeatureLayer objects.

In [5]:
lyrs = items[0].layers
In [6]:
for lyr in lyrs:
In [7]:
target_community = lyrs[0]
candidates = lyrs[1]
In [8]:
m1 ='Knoxville')