Data Summarization - Construction permits, part 2/2

In the "Explore and analyze construction permits" notebook, we explored your data and learned a little about the spatial and temporal trends of permit activity in Montgomery County. In this lesson, we'll move beyond exploration and run spatial analysis tools to answer specific questions that can't be answered by the data itself. In particular, we want to know why permits spiked in Germantown in 2011 and predict where future permit spikes - and, by extension, future growth - are likely to occur.

First, we'll aggregate the points by ZIP Code. We'll enrich each ZIP Code with demographic information and learn more about the demographic conditions that led to such rapid growth in such a short time. Once you determine why growth occurred where and when it did, we'll locate other ZIP Codes with similar demographic characteristics to predict future growth.

Aggregate points

from arcgis import GIS
gis = GIS("home")
data ="Commercial_Permits_since_2010 owner:api_data_owner",
                          'Feature layer',
test dataFeature Layer Collection by api_data_owner
Last Modified: July 01, 2019
0 comments, 362 views
permits = data[0]
permit_layer = permits.layers[0]

Use authoritative data from Living Atlas to assign a variable to the item.

zip_item = gis.content.get('a1569e93ecd2408d89f42e8770a90f76')
United States ZIP Code Boundaries 2021
This layer shows the ZIP Code level boundaries of United States in 2021, designed to be used in Data Enrichment analysis.Feature Layer Collection by esri_dm
Last Modified: September 14, 2022
2 comments, 51459 views

Since the item is a feature layer collection, using the layers property will give us a list of layers.

for lyr in zip_item.layers:
zip_code_layer = zip_item.layers[3]

Next, you'll use this layer to aggregate permit points. By default, the parameters are set to use the ZIP Codes as the area layer, the permits as the layer to be aggregated, and the layer style to be based on permit count. These parameters are exactly what you want.

from arcgis.features.summarize_data import aggregate_points
from datetime import datetime as dt
permit_agg_by_zip = aggregate_points(permit_layer, zip_code_layer, 
                                     output_name='zipcode_aggregate_' + str(
{"cost": 43.425}
Feature Layer Collection by arcgis_python
Last Modified: April 26, 2023
0 comments, 1 views

Aggregation results

agg_map ="Montgomery County, Maryland")


The new layer looks like a point layer, but it's actually a polygon layer with a point symbology. Each point represents the number of permits per ZIP Code area. Larger points indicate ZIP Codes with more permits.

import pandas as pd
sdf = pd.DataFrame.spatial.from_layer(permit_agg_by_zip.layers[0])
0120012WashingtonDC151392.3666.103444{"rings": [[[-77.0524151, 38.9865583], [-77.05...
1220783HyattsvilleMD468886.25116.194162{"rings": [[[-77.002459, 38.96569], [-77.00242...
2320814BethesdaMD313045.11114313.233003{"rings": [[[-77.1325511, 39.0259945], [-77.13...
3420815Chevy ChaseMD295305.3558413.866827{"rings": [[[-77.1122705, 38.9738032], [-77.11...
4520816BethesdaMD161594.6115511.935862{"rings": [[[-77.1795738, 38.9683754], [-77.17...
5620817BethesdaMD3775113.8973435.980035{"rings": [[[-77.2136659, 38.9785558], [-77.21...
6720818Cabin JohnMD12760.98132.540313{"rings": [[[-77.1793107, 38.9697979], [-77.17...
7820832OlneyMD247239.4321224.412097{"rings": [[[-77.112229, 39.183879], [-77.1119...
8920833BrookevilleMD825022.874059.226278{"rings": [[[-77.114838, 39.267372], [-77.1148...
91020837PoolesvilleMD609242.151109.04284{"rings": [[[-77.503682, 39.115185], [-77.5030...

Review some basic statistics about the data.

agg_layer = permit_agg_by_zip.layers[0]

Although most of the large point symbols on the map are in the southeast corner, near Washington, D.C., there are a few large points in the northwest. In particular, there is a very large circle in the ZIP Code located in Clarksburg. (If you're using different ZIP Code data, this area may be identified as ZIP Code 20871 instead.) The ZIP code has 948 permits. Additionally, this area geographically corresponds to the hot spot you identified in the previous lesson. This ZIP Code is one that you'll focus on when you enrich your layer with demographic data.

Enrich the data

Are there demographic characteristics about the Clarksburg ZIP Code that contributed to its high growth? If so, are there other areas with those characteristics that may experience growth in the future? To answer these questions, you'll use the Enrich Data analysis tool. This tool adds demographic attributes of your choice to your data. Specifically, you'll add Tapestry information to each ZIP Code. Tapestry is a summary of many demographic and socioeconomic variables, including age groups and lifestyle choices. It'll teach you more about the types of people who live in your area of interest and help you better understand the reasons why growth happened where it did.

from arcgis.features.enrich_data import enrich_layer

The analysis variable TSEGNAME is 2022 Dominant Tapestry Segment Name such as Exurbanites, City Lights, Metro Renters, etc. The detailed summary of various segments can be found in here.

enrich_aggregate = enrich_layer(agg_layer, 
                                output_name="added_tapestry_var_" + str(
{"cost": -1}
Feature Layer Collection by arcgis_python
Last Modified: April 26, 2023
0 comments, 0 views
agg_lyr = enrich_aggregate.layers[0]
sdf = pd.DataFrame.spatial.from_layer(agg_lyr)
0120012WashingtonDC151392.3666.1034440US1BlockApportionment:US.BlockGroups;PointsLayer:...2.1912.5761City Lights{"rings": [[[-77.0524151, 38.9865583000001], [...
1220783HyattsvilleMD468886.25116.1941621US2BlockApportionment:US.BlockGroups;PointsLayer:...2.1912.5761NeWest Residents{"rings": [[[-77.002459, 38.9656900000001], [-...
2320814BethesdaMD313045.11114313.2330032US3BlockApportionment:US.BlockGroups;PointsLayer:...2.1912.5761Metro Renters{"rings": [[[-77.1325510999999, 39.0259945], [...
3420815Chevy ChaseMD295305.3558413.8668273US4BlockApportionment:US.BlockGroups;PointsLayer:...2.1912.5761Top Tier{"rings": [[[-77.1122705, 38.9738032000001], [...
4520816BethesdaMD161594.6115511.9358624US5BlockApportionment:US.BlockGroups;PointsLayer:...2.1912.5761Top Tier{"rings": [[[-77.1795738, 38.9683754000001], [...
enrich_aggregate_map ='Montgomery County, Maryland')


sdf.spatial.plot(kind='map', map_widget=enrich_aggregate_map,

Click some of the ZIP Codes.

The Tapestry segment is displayed when you click a ZIP Code. The Tapestry segments have names such as Enterprising Professionals and Savvy Suburbanites. You can look up more information about each segment, including its specific demographic characteristics, on the Tapestry Segmentation help page.

What Tapestry segment is dominant for the Clarksburg ZIP Code where major growth occurred? Click the Clarksburg ZIP Code to find out. According to the pop-up, Boomburbs is the dominant Tapestry segment for the ZIP Code. Boomburbs have many young professionals with families living in affordable new housing. This description may explain why the area saw such rapid residential growth in 2011. It's possible that other ZIP Codes with similar demographic profiles may experience rapid growth in the near future.

Click the ZIP Code directly southwest of Clarksburg.

This ZIP Code is in Boyds. It also has the Boomburbs Tapestry segment. However, its number of permits has been relatively low since 2010. The county may be able to anticipate a similar spike in permit activity in this area.

Although Tapestry segments are based on several demographic characteristics, you could also perform this analysis with other variables. For instance, you could determine if there is a correlation between high permit activity and high population growth. Is a young population or a high income level a stronger indicator of growth? You can answer these questions and others with the analysis tools at your disposal. For the purposes of this lesson, however, your results are satisfactory.

enrich_aggregate_map.add_layer(agg_lyr, {'renderer':'ClassedSizeRenderer',

Share your work

We've analyzed your data and come to a couple conclusions about your data. Next, we'll share your results online. Currently, our result layers are layers that are accessible only to you. Sharing our data will make it easier for county officials to use your data in other ArcGIS applications and communicate key information to the public. In particular, we'll share your work to ArcGIS Online. We'll share your enriched ZIP Codes dataset as feature layers that can be added to any web map.

The layer contains fields for both the count of permits per ZIP Code and the dominant Tapestry segment—basically all of the result data we created in your analysis. We'll only need to share this layer, not the original aggregation layer.

Using the share() method you can share your work with others.

{'results': [{'itemId': 'c8f22bc2c530432f9033b1f20241a7c2',
   'success': True,
   'notSharedWith': []}]}

In this notebook, we used ArcGIS API for Python to explore and analyze permit data for Montgomery County, Maryland. You answered questions about your data's spatial and temporal trends and located areas of the county with rapid growth. We compared your findings with demographic data, came to conclusions about the possible causes of growth, and even predicted an area that may experience similar growth in the future based on shared demographic characteristics. With ArcGIS API for Python, we can perform a similar workflow on any of your data to better understand what it contains and what questions it can answer.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.