18  Locating the City Center

Code
import geopandas as gpd
Code
df = gpd.read_file('https://www2.census.gov/geo/tiger/TIGER2019/PLACE/tl_2019_01_place.zip')
Code
df.plot()

Code
states = [str(i).rjust(2,'0') for i in range(1,72) ]    
Code
places = []
for state in states:
    try:
        df =  gpd.read_file(f'https://www2.census.gov/geo/tiger/TIGER2019/PLACE/tl_2019_{state}_place.zip')
        df.to_parquet(f"places/place_{state}.parquet")
        places.append(df)
    except:
        pass
places = gpd.GeoDataFrame(pd.concat(places))
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/ipykernel_launcher.py:5: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata.  This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec

This metadata specification does not yet make stability promises.  We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.

To further ignore this warning, you can do: 
import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')
  """
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-62034bb930a5> in <module>
      7     except:
      8         pass
----> 9 places = gpd.GeoDataFrame(pd.concat(places))

NameError: name 'pd' is not defined
Code
places.to_parquet('census_places_2019.parquet')
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata.  This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec

This metadata specification does not yet make stability promises.  We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.

To further ignore this warning, you can do: 
import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')
  """Entry point for launching an IPython kernel.
Code
import pandas as pd
import os
Code
p = []
for fn in os.listdir("places/"):
    df = gpd.read_parquet(f"places/{fn}")
    p.append(df)
df = pd.concat(p)
Code
df
Code
places = gpd.GeoDataFrame(pd.concat(places))
Code
places.head()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-f0b6cca7e69c> in <module>
----> 1 places.head()

NameError: name 'places' is not defined
Code
df.to_parquet("places.parquet")
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-753b859ae21b> in <module>
----> 1 df.to_parquet("places.parquet")

NameError: name 'df' is not defined
Code
df = gpd.read_parquet("places.parquet")
Code
df.CLASSFP
0      C5
0      C1
1      C1
2      C1
3      C1
       ..
445    U1
446    U1
447    U1
448    U1
449    U1
Name: CLASSFP, Length: 29590, dtype: object
Code
df = df[df.CLASSFP.str.startswith('C1')]
Code
df = df[df.PCICBSA=='Y']
Code
df.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 1252 entries, 0 to 89
Data columns (total 17 columns):
 #   Column    Non-Null Count  Dtype   
---  ------    --------------  -----   
 0   STATEFP   1252 non-null   object  
 1   PLACEFP   1252 non-null   object  
 2   PLACENS   1252 non-null   object  
 3   GEOID     1252 non-null   object  
 4   NAME      1252 non-null   object  
 5   NAMELSAD  1252 non-null   object  
 6   LSAD      1252 non-null   object  
 7   CLASSFP   1252 non-null   object  
 8   PCICBSA   1252 non-null   object  
 9   PCINECTA  1252 non-null   object  
 10  MTFCC     1252 non-null   object  
 11  FUNCSTAT  1252 non-null   object  
 12  ALAND     1252 non-null   int64   
 13  AWATER    1252 non-null   int64   
 14  INTPTLAT  1252 non-null   object  
 15  INTPTLON  1252 non-null   object  
 16  geometry  1252 non-null   geometry
dtypes: geometry(1), int64(2), object(14)
memory usage: 176.1+ KB
Code
df.plot()

Code
df = df.to_crs(4326)
Code
from geosnap import datasets
Loading manifest: 100%|██████████| 3/3 [00:00<00:00, 2606.78entries/s]
Loading manifest: 100%|██████████| 52/52 [00:00<00:00, 23624.76entries/s]
Loading manifest: 100%|██████████| 5/5 [00:00<00:00, 14364.05entries/s]
Loading manifest: 100%|██████████| 5/5 [00:00<00:00, 9110.13entries/s]
Loading manifest: 100%|██████████| 57/57 [00:00<00:00, 31129.60entries/s]
Loading manifest: 100%|██████████| 3/3 [00:00<00:00, 2126.57entries/s]
Code
metros = datasets.msas()
Code
metros = metros[metros['type'].str.startswith('Metro')]
Code
metros
geoid name type geometry
2 10180 Abilene, TX Metro Area POLYGON ((-100.14654 32.52279, -100.14642 32.5...
6 10380 Aguadilla-Isabela, PR Metro Area POLYGON ((-67.20794 18.44228, -67.20844 18.443...
7 10420 Akron, OH Metro Area POLYGON ((-81.39169 41.34827, -81.39164 41.348...
9 10500 Albany, GA Metro Area POLYGON ((-84.45040 31.62187, -84.45045 31.621...
10 10540 Albany, OR Metro Area POLYGON ((-123.25099 44.55198, -123.25240 44.5...
... ... ... ... ...
937 49420 Yakima, WA Metro Area POLYGON ((-121.42324 46.49274, -121.42330 46.4...
939 49620 York-Hanover, PA Metro Area POLYGON ((-77.05440 40.02321, -77.05441 40.023...
940 49660 Youngstown-Warren-Boardman, OH-PA Metro Area POLYGON ((-81.00229 41.13419, -81.00232 41.145...
941 49700 Yuba City, CA Metro Area POLYGON ((-121.62376 39.29562, -121.62339 39.2...
942 49740 Yuma, AZ Metro Area POLYGON ((-114.76400 32.64336, -114.76331 32.6...

389 rows × 4 columns

Code
metros.to_file('metros.shp')
Code
metros.crs
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Code
df.crs
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Code
cities = df[df.centroid.intersects(metros.unary_union)]
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  """Entry point for launching an IPython kernel.
Code
cities.to_parquet('principle_cities.parquet')
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata.  This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec

This metadata specification does not yet make stability promises.  We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.

To further ignore this warning, you can do: 
import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')
  """Entry point for launching an IPython kernel.
Code
cities.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 694 entries, 0 to 89
Data columns (total 17 columns):
 #   Column    Non-Null Count  Dtype   
---  ------    --------------  -----   
 0   STATEFP   694 non-null    object  
 1   PLACEFP   694 non-null    object  
 2   PLACENS   694 non-null    object  
 3   GEOID     694 non-null    object  
 4   NAME      694 non-null    object  
 5   NAMELSAD  694 non-null    object  
 6   LSAD      694 non-null    object  
 7   CLASSFP   694 non-null    object  
 8   PCICBSA   694 non-null    object  
 9   PCINECTA  694 non-null    object  
 10  MTFCC     694 non-null    object  
 11  FUNCSTAT  694 non-null    object  
 12  ALAND     694 non-null    int64   
 13  AWATER    694 non-null    int64   
 14  INTPTLAT  694 non-null    object  
 15  INTPTLON  694 non-null    object  
 16  geometry  694 non-null    geometry
dtypes: geometry(1), int64(2), object(14)
memory usage: 97.6+ KB
Code
cities.plot()

Code
from libpysal.weights import Queen
Code
w = Queen.from_dataframe(cities)
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/libpysal/weights/weights.py:172: UserWarning: The weights matrix is not fully connected: 
 There are 513 disconnected components.
 There are 414 islands with ids: 1, 5, 6, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 26, 31, 33, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50, 51, 52, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, 70, 71, 72, 73, 77, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 98, 99, 100, 102, 103, 104, 105, 107, 108, 109, 112, 113, 114, 115, 117, 118, 119, 121, 122, 123, 125, 126, 131, 132, 134, 136, 137, 138, 139, 142, 149, 150, 151, 153, 154, 155, 156, 159, 163, 165, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 195, 196, 197, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 215, 216, 218, 221, 222, 223, 225, 228, 231, 232, 235, 236, 237, 238, 240, 245, 252, 254, 255, 256, 257, 259, 261, 262, 263, 264, 265, 266, 269, 270, 271, 273, 276, 280, 281, 282, 287, 288, 289, 290, 291, 292, 293, 295, 296, 297, 298, 300, 302, 304, 305, 306, 307, 308, 309, 311, 312, 313, 314, 315, 317, 318, 319, 320, 321, 322, 325, 326, 327, 330, 331, 332, 333, 334, 335, 336, 337, 339, 340, 341, 342, 344, 345, 346, 347, 348, 349, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 367, 368, 369, 370, 371, 373, 374, 375, 376, 377, 378, 379, 380, 384, 385, 387, 388, 389, 390, 391, 392, 393, 395, 396, 397, 398, 399, 406, 407, 410, 418, 419, 420, 424, 428, 431, 432, 433, 434, 437, 443, 445, 446, 447, 456, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 469, 470, 474, 476, 477, 478, 479, 480, 481, 482, 485, 486, 487, 491, 492, 497, 498, 499, 504, 505, 506, 510, 511, 523, 525, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 545, 547, 548, 551, 552, 554, 555, 556, 557, 559, 562, 565, 569, 570, 571, 572, 573, 574, 578, 579, 581, 582, 583, 584, 589, 590, 592, 593, 594, 597, 598, 600, 602, 603, 604, 606, 611, 612, 616, 618, 620, 621, 622, 625, 627, 628, 630, 632, 634, 638, 639, 640, 641, 642, 643, 646, 648, 650, 651, 652, 653, 654, 656, 657, 659, 663, 664, 666, 667, 668, 669, 672, 673, 674, 676, 678, 681, 686, 687, 688, 689, 691, 692, 693.
  warnings.warn(message)
Code
cities['labels'] = w.component_labels
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/geopandas/geodataframe.py:853: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  super(GeoDataFrame, self).__setitem__(key, value)
Code
cities = cities.dissolve(by='labels')
Code
cities.plot()

Code
cities.to_parquet('central_cities_dissolve.parquet')
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata.  This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec

This metadata specification does not yet make stability promises.  We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.

To further ignore this warning, you can do: 
import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')
  """Entry point for launching an IPython kernel.
Code
cit = gpd.read_parquet('central_cities_dissolve.parquet')
Code
cit.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 513 entries, 0 to 512
Data columns (total 17 columns):
 #   Column    Non-Null Count  Dtype   
---  ------    --------------  -----   
 0   geometry  513 non-null    geometry
 1   STATEFP   513 non-null    object  
 2   PLACEFP   513 non-null    object  
 3   PLACENS   513 non-null    object  
 4   GEOID     513 non-null    object  
 5   NAME      513 non-null    object  
 6   NAMELSAD  513 non-null    object  
 7   LSAD      513 non-null    object  
 8   CLASSFP   513 non-null    object  
 9   PCICBSA   513 non-null    object  
 10  PCINECTA  513 non-null    object  
 11  MTFCC     513 non-null    object  
 12  FUNCSTAT  513 non-null    object  
 13  ALAND     513 non-null    int64   
 14  AWATER    513 non-null    int64   
 15  INTPTLAT  513 non-null    object  
 16  INTPTLON  513 non-null    object  
dtypes: geometry(1), int64(2), object(14)
memory usage: 72.1+ KB
Code
cities.to_file('central_cities_dissolve.shp')
Code
cities.NAME
labels
0        Washington
1            Jasper
2           Opelika
3            Daphne
4       Gulf Shores
           ...     
508     Casa Grande
509            Yuma
510       Flagstaff
511         Douglas
512    Sierra Vista
Name: NAME, Length: 513, dtype: object
Code
cit['poly'] = cit.geometry
Code
cit.plot()

Code
centers = gpd.sjoin(cit.set_geometry(cit.point), metros, how='left', op='intersects')
Code
centers = centers.set_geometry('poly')
Code
centers['geometry'] = centers.poly
Code
centers = centers.to_crs('ESRI:102003')
Code
centers['area'] = centers.area
Code
centers = centers.to_crs(4326)
Code
c = centers.sort_values('area', ascending=False).groupby('name').first()
Code
c.plot()

Code
c.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
Index: 379 entries, Abilene, TX to Yuma, AZ
Data columns (total 23 columns):
 #   Column       Non-Null Count  Dtype   
---  ------       --------------  -----   
 0   geometry     379 non-null    geometry
 1   STATEFP      379 non-null    object  
 2   PLACEFP      379 non-null    object  
 3   PLACENS      379 non-null    object  
 4   GEOID        379 non-null    object  
 5   NAME         379 non-null    object  
 6   NAMELSAD     379 non-null    object  
 7   LSAD         379 non-null    object  
 8   CLASSFP      379 non-null    object  
 9   PCICBSA      379 non-null    object  
 10  PCINECTA     379 non-null    object  
 11  MTFCC        379 non-null    object  
 12  FUNCSTAT     379 non-null    object  
 13  ALAND        379 non-null    int64   
 14  AWATER       379 non-null    int64   
 15  INTPTLAT     379 non-null    object  
 16  INTPTLON     379 non-null    object  
 17  point        379 non-null    geometry
 18  poly         379 non-null    geometry
 19  index_right  379 non-null    int64   
 20  geoid        379 non-null    object  
 21  type         379 non-null    object  
 22  area         379 non-null    float64 
dtypes: float64(1), geometry(3), int64(3), object(16)
memory usage: 71.1+ KB
Code
centers[centers.name.duplicated()]
geometry STATEFP PLACEFP PLACENS GEOID NAME NAMELSAD LSAD CLASSFP PCICBSA ... FUNCSTAT ALAND AWATER INTPTLAT INTPTLON index_right geoid name type area
labels
4 MULTIPOLYGON (((-87.79286 30.25371, -87.79238 ... 01 32272 02403770 0132272 Gulf Shores Gulf Shores city 25 C1 Y ... A 72971664 12553117 +30.2758365 -087.7012579 222 19300 Daphne-Fairhope-Foley, AL Metro Area 1.700604e+08
6 MULTIPOLYGON (((-88.27611 30.68601, -88.27610 ... 01 50000 02404278 0150000 Mobile Mobile city 25 C1 Y ... A 361212260 105131231 +30.6684260 -088.1002261 222 19300 Daphne-Fairhope-Foley, AL Metro Area 4.663432e+08
8 MULTIPOLYGON (((-86.78362 33.38917, -86.78329 ... 01 07000 02403868 0107000 Birmingham Birmingham city 25 C1 Y ... A 378334037 6593183 +33.5274441 -086.7990470 93 13820 Birmingham-Hoover, AL Metro Area 5.114027e+08
13 MULTIPOLYGON (((-87.61092 34.79391, -87.61081 ... 01 53016 02404345 0153016 Muscle Shoals Muscle Shoals city 25 C1 Y ... A 42828532 53102 +34.7436917 -087.6337742 301 22520 Florence-Muscle Shoals, AL Metro Area 4.288163e+07
19 MULTIPOLYGON (((-105.10918 39.95657, -105.1091... 08 09280 02409919 0809280 Broomfield Broomfield city 25 C1 Y ... A 85478765 1411396 +39.9535933 -105.0507868 109 14500 Boulder, CO Metro Area 8.689016e+07
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
501 POLYGON ((-112.05493 41.09977, -112.05493 41.0... 49 13850 02409478 4913850 Clearfield Clearfield city 25 C1 Y ... A 19977448 76889 +41.0970119 -112.0179202 630 36260 Ogden-Clearfield, UT Metro Area 2.005434e+07
502 POLYGON ((-112.02580 41.20775, -112.02580 41.2... 49 55980 02411305 4955980 Ogden Ogden city 25 C1 Y ... A 71310928 8202 +41.2283911 -111.9681469 630 36260 Ogden-Clearfield, UT Metro Area 7.131913e+07
506 POLYGON ((-114.37605 34.45516, -114.37597 34.4... 04 39370 02411604 0439370 Lake Havasu City Lake Havasu City city 25 C1 Y ... A 120017121 118649 +34.4998087 -114.3109427 468 29420 Lake Havasu City-Kingman, AZ Metro Area 1.201358e+08
508 POLYGON ((-111.91222 32.97363, -111.91218 32.9... 04 10530 02409401 0410530 Casa Grande Casa Grande city 25 C1 Y ... A 286524729 0 +32.9068161 -111.7623250 675 38060 Phoenix-Mesa-Scottsdale, AZ Metro Area 2.865247e+08
512 POLYGON ((-110.44915 31.55034, -110.44864 31.5... 04 66820 02411898 0466820 Sierra Vista Sierra Vista city 25 C1 Y ... A 394236527 678788 +31.5654097 -110.3145084 797 43420 Sierra Vista-Douglas, AZ Metro Area 3.949154e+08

190 rows × 22 columns

Code
centers = centers.groupby('geoid').max()
Code
idx = centers.groupby(['geoid'])['area'].transform(max) == centers['area']
Code
centers[idx].plot()

Code
#centers=centers.merge(centers[['GEOID', 'geometry']], on='GEOID', how='left')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-76-ee1a4bb0dce4> in <module>
----> 1 centers=centers.merge(centers[['GEOID', 'geometry']], on='GEOID', how='left')

~/anaconda3/envs/geosnap/lib/python3.7/site-packages/geopandas/geodataframe.py in __getitem__(self, key)
    826         GeoDataFrame.
    827         """
--> 828         result = super(GeoDataFrame, self).__getitem__(key)
    829         geo_col = self._geometry_column_name
    830         if isinstance(result, Series) and isinstance(result.dtype, GeometryDtype):

~/anaconda3/envs/geosnap/lib/python3.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
   2906             if is_iterator(key):
   2907                 key = list(key)
-> 2908             indexer = self.loc._get_listlike_indexer(key, axis=1, raise_missing=True)[1]
   2909 
   2910         # take() does not accept boolean indexers

~/anaconda3/envs/geosnap/lib/python3.7/site-packages/pandas/core/indexing.py in _get_listlike_indexer(self, key, axis, raise_missing)
   1252             keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr)
   1253 
-> 1254         self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
   1255         return keyarr, indexer
   1256 

~/anaconda3/envs/geosnap/lib/python3.7/site-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
   1302             if raise_missing:
   1303                 not_found = list(set(key) - set(ax))
-> 1304                 raise KeyError(f"{not_found} not in index")
   1305 
   1306             # we skip the warning on Categorical

KeyError: "['geometry'] not in index"
Code
cernters
STATEFP PLACEFP PLACENS GEOID NAME NAMELSAD LSAD CLASSFP PCICBSA PCINECTA ... FUNCSTAT ALAND AWATER INTPTLAT INTPTLON index_right name type area geometry
0 48 01000 02409657 4801000 Abilene Abilene city 25 C1 Y N ... A 276270546 14051306 +32.4545143 -099.7381473 2 Abilene, TX Metro Area 2.903218e+08 POLYGON ((-99.86773 32.41347, -99.86768 32.420...
1 39 01000 01086993 3901000 Akron Akron city 25 C2 Y N ... A 160405168 884027 +41.0804559 -081.5214295 7 Akron, OH Metro Area 1.612892e+08 POLYGON ((-81.62124 41.14475, -81.62097 41.144...
2 13 01052 02403072 1301052 Albany Albany city 25 C1 Y N ... A 142617730 1971517 +31.5781167 -084.1762242 9 Albany, GA Metro Area 1.445892e+08 POLYGON ((-84.27315 31.54890, -84.27309 31.552...
3 41 41650 02410815 4141650 Lebanon Lebanon city 25 C1 Y N ... A 45431585 599982 +44.6269277 -123.2782855 10 Albany, OR Metro Area 4.596690e+07 MULTIPOLYGON (((-122.93887 44.52454, -122.9366...
4 36 75484 00979559 3675484 Troy Troy city 25 C5 Y N ... A 55433143 1811726 +43.3111604 -073.9271999 11 Albany-Schenectady-Troy, NY Metro Area 5.681382e+07 POLYGON ((-73.70646 42.69408, -73.70292 42.699...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
377 53 80010 02412314 5380010 Yakima Yakima city 25 C1 Y N ... A 71988334 1114284 +46.5909379 -120.5494001 937 Yakima, WA Metro Area 7.310261e+07 POLYGON ((-120.64445 46.56200, -120.64368 46.5...
378 42 87048 01215771 4287048 York York city 25 C5 Y N ... A 13709021 126494 +39.9647979 -076.9836050 939 York-Hanover, PA Metro Area 1.383553e+07 POLYGON ((-76.76269 39.96530, -76.75515 39.966...
379 39 88000 01087046 3988000 Youngstown Youngstown city 25 C5 Y N ... A 87880811 1645053 +41.2395643 -080.8160147 940 Youngstown-Warren-Boardman, OH-PA Metro Area 1.291481e+08 POLYGON ((-80.71127 41.02529, -80.71126 41.025...
380 06 86972 02412325 0686972 Yuba City Yuba City city 25 C1 Y N ... A 38591779 201005 +39.1385876 -121.6396607 941 Yuba City, CA Metro Area 3.879279e+07 POLYGON ((-121.68887 39.14511, -121.68885 39.1...
381 04 85540 02412328 0485540 Yuma Yuma city 25 C1 Y N ... A 313934389 180936 +32.6974525 -114.6846497 942 Yuma, AZ Metro Area 3.141152e+08 POLYGON ((-114.68474 32.69658, -114.68457 32.6...

382 rows × 21 columns

Code
centers = centers[idx]
Code
c.to_file('central_cities_dissolve.shp')
Code
centers[centers.geoid.duplicated()]
geometry STATEFP PLACEFP PLACENS GEOID NAME NAMELSAD LSAD CLASSFP PCICBSA ... FUNCSTAT ALAND AWATER INTPTLAT INTPTLON index_right geoid name type area
labels

0 rows × 22 columns

Code
centers[centers.STATEFP=='06'].plot()

Code
centers.iloc[centers.reset_index().groupby(['geoid'])['area'].idxmax()].plot()

Code
centers[centers.geoid.duplicated()]
geometry STATEFP PLACEFP PLACENS GEOID NAME NAMELSAD LSAD CLASSFP PCICBSA ... FUNCSTAT ALAND AWATER INTPTLAT INTPTLON index_right geoid name type area
labels
4 MULTIPOLYGON (((787614.896 -775217.231, 787659... 01 32272 02403770 0132272 Gulf Shores Gulf Shores city 25 C1 Y ... A 72971664 12553117 +30.2758365 -087.7012579 222 19300 Daphne-Fairhope-Foley, AL Metro Area 1.700604e+08
6 MULTIPOLYGON (((737445.418 -731241.633, 737446... 01 50000 02404278 0150000 Mobile Mobile city 25 C1 Y ... A 361212260 105131231 +30.6684260 -088.1002261 222 19300 Daphne-Fairhope-Foley, AL Metro Area 4.663432e+08
8 MULTIPOLYGON (((850368.820 -418779.804, 850403... 01 07000 02403868 0107000 Birmingham Birmingham city 25 C1 Y ... A 378334037 6593183 +33.5274441 -086.7990470 93 13820 Birmingham-Hoover, AL Metro Area 5.114027e+08
13 MULTIPOLYGON (((760402.775 -269457.550, 760411... 01 53016 02404345 0153016 Muscle Shoals Muscle Shoals city 25 C1 Y ... A 42828532 53102 +34.7436917 -087.6337742 301 22520 Florence-Muscle Shoals, AL Metro Area 4.288163e+07
19 MULTIPOLYGON (((-770128.541 312262.315, -77012... 08 09280 02409919 0809280 Broomfield Broomfield city 25 C1 Y ... A 85478765 1411396 +39.9535933 -105.0507868 109 14500 Boulder, CO Metro Area 8.689016e+07
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
501 POLYGON ((-1331444.882 516111.263, -1331441.14... 49 13850 02409478 4913850 Clearfield Clearfield city 25 C1 Y ... A 19977448 76889 +41.0970119 -112.0179202 630 36260 Ogden-Clearfield, UT Metro Area 2.005434e+07
502 POLYGON ((-1327022.624 527621.424, -1327013.84... 49 55980 02411305 4955980 Ogden Ogden city 25 C1 Y ... A 71310928 8202 +41.2283911 -111.9681469 630 36260 Ogden-Clearfield, UT Metro Area 7.131913e+07
506 POLYGON ((-1664713.268 -179476.347, -1664703.1... 04 39370 02411604 0439370 Lake Havasu City Lake Havasu City city 25 C1 Y ... A 120017121 118649 +34.4998087 -114.3109427 468 29420 Lake Havasu City-Kingman, AZ Metro Area 1.201358e+08
508 POLYGON ((-1471347.771 -382966.082, -1471342.2... 04 10530 02409401 0410530 Casa Grande Casa Grande city 25 C1 Y ... A 286524729 0 +32.9068161 -111.7623250 675 38060 Phoenix-Mesa-Scottsdale, AZ Metro Area 2.865247e+08
512 POLYGON ((-1361189.150 -561405.307, -1361121.0... 04 66820 02411898 0466820 Sierra Vista Sierra Vista city 25 C1 Y ... A 394236527 678788 +31.5654097 -110.3145084 797 43420 Sierra Vista-Douglas, AZ Metro Area 3.949154e+08

190 rows × 22 columns

Code
centers= centers.sort_values('area', ascending=False)
Code
centers.columns
Index(['geometry', 'STATEFP', 'PLACEFP', 'PLACENS', 'GEOID', 'NAME',
       'NAMELSAD', 'LSAD', 'CLASSFP', 'PCICBSA', 'PCINECTA', 'MTFCC',
       'FUNCSTAT', 'ALAND', 'AWATER', 'INTPTLAT', 'INTPTLON', 'index_right',
       'geoid', 'name', 'type', 'area'],
      dtype='object')
Code
out = centers.groupby('index_right').first()
Code
out.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 382 entries, 2 to 942
Data columns (total 21 columns):
 #   Column    Non-Null Count  Dtype   
---  ------    --------------  -----   
 0   geometry  382 non-null    geometry
 1   STATEFP   382 non-null    object  
 2   PLACEFP   382 non-null    object  
 3   PLACENS   382 non-null    object  
 4   GEOID     382 non-null    object  
 5   NAME      382 non-null    object  
 6   NAMELSAD  382 non-null    object  
 7   LSAD      382 non-null    object  
 8   CLASSFP   382 non-null    object  
 9   PCICBSA   382 non-null    object  
 10  PCINECTA  382 non-null    object  
 11  MTFCC     382 non-null    object  
 12  FUNCSTAT  382 non-null    object  
 13  ALAND     382 non-null    int64   
 14  AWATER    382 non-null    int64   
 15  INTPTLAT  382 non-null    object  
 16  INTPTLON  382 non-null    object  
 17  geoid     382 non-null    object  
 18  name      382 non-null    object  
 19  type      382 non-null    object  
 20  area      382 non-null    float64 
dtypes: float64(1), geometry(1), int64(2), object(17)
memory usage: 65.7+ KB
Code
c = centers.groupby('geoid').agg({'area': max, 'GEOID': 'first'})
Code
centers.groupby('geoid').agg({'area'})
Code
c
area GEOID
geoid
10180 2.903218e+08 4801000
10420 1.612892e+08 3901000
10500 1.445892e+08 1301052
10540 4.596690e+07 4101000
10580 5.681382e+07 3601000
... ... ...
49420 7.310261e+07 5380010
49620 1.383553e+07 4287048
49660 1.291481e+08 3988000
49700 3.879279e+07 0686972
49740 3.141152e+08 0485540

382 rows × 2 columns

Code
centers[centers.GEOID.isin(c.GEOID)].to_file('test.shp')
Code
c.to_file('test.shp')
Code
c = c.drop(columns=['point', 'poly'])
Code
c.to_parquet('central_cities_dissolve.parquet')
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata.  This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec

This metadata specification does not yet make stability promises.  We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.

To further ignore this warning, you can do: 
import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')
  """Entry point for launching an IPython kernel.
Code
from segregation.util import project_gdf
Code
c.set_geometry(c.centroid).to_file('central_city_points.shp')
Code
def concentrics(df, center, threshold = .1, step=500, popvar='n_total_pop'):
    
    total_pop = df[popvar].sum()
    total=0
    distance=500
    
    df = project_gdf(df)
    center = project_gdf(center)
    
    while total < threshold * total_pop:
        ring = center.buffer(distance)
        total = df[df.centroid.intersects(ring.unary_union)][popvar].sum()
        distance += step
    return distance, ring.to_crs(4326)
Code
from geosnap import Community
Code
dc = Community.from_census(msa_fips='47900', years=[2010]).gdf
Code
centers = c.set_geometry(c.centroid)
Code
centers.crs=4326
Code
dc_center = centers[centers.index.str.startswith('Washington-Arli')]
Code
dist = concentrics(dc, dc_center)
Code
dist
8000
Code
df = project_gdf(dc)
center = project_gdf(dc_center)
Code
dc['n_total_pop'].sum()
5671300.0
Code
ring = center.buffer(8000)
Code
import matplotlib.pyplot as plt
import contextily as ctx

fig, ax = plt.subplots()


ring.to_crs(3857).plot(ax=ax, color="none", edgecolor='r')
ctx.add_basemap(ax)

Code

    while total < threshold * total_pop:
        ring = center.buffer(distance)
        total = df[df.centroid.intersects(ring)][popvar].sum()
        distance += step
Code
df.crs
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Code
ring.crs
<Projected CRS: +proj=utm +zone=18 +ellps=WGS84 +datum=WGS84 +unit ...>
Name: unknown
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- undefined
Coordinate Operation:
- name: UTM zone 18N
- method: Transverse Mercator
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Code
subset=df[df.centroid.intersects(ring.unary_union)]
Code
total = df[df.centroid.intersects(ring)]['n_total_pop'].reset_index().sum()
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/geopandas/base.py:39: UserWarning: The indices of the two GeoSeries are different.
  warn("The indices of the two GeoSeries are different.")
/Users/knaaptime/anaconda3/envs/geosnap/lib/python3.7/site-packages/geopandas/geodataframe.py:828: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  result = super(GeoDataFrame, self).__getitem__(key)
Code
total
index          0.0
n_total_pop    0.0
dtype: float64
Code
subset
geoid n_asian_under_15 n_black_under_15 n_hispanic_under_15 n_native_under_15 n_white_under_15 n_persons_under_18 n_asian_over_60 n_black_over_60 n_hispanic_over_60 ... year n_total_housing_units_sample p_nonhisp_white_persons p_white_over_60 p_black_over_60 p_hispanic_over_60 p_native_over_60 p_asian_over_60 p_disabled geometry
26 11001005600 19.0 0.0 0.0 0.0 28.0 67.0 NaN NaN NaN ... 2010 4310.0 65.07177 NaN NaN NaN NaN NaN NaN POLYGON ((321560.247 4307974.792, 321661.855 4...

1 rows × 194 columns

Code
centers.geometry
name
Abilene, TX                           POINT (-99.73840 32.45428)
Akron, OH                             POINT (-81.52195 41.07985)
Albany, GA                            POINT (-84.17626 31.57755)
Albany, OR                           POINT (-123.09671 44.62745)
Albany-Schenectady-Troy, NY           POINT (-73.79868 42.66640)
                                                ...             
Yakima, WA                           POINT (-120.54956 46.59228)
York-Hanover, PA                      POINT (-76.73154 39.96510)
Youngstown-Warren-Boardman, OH-PA     POINT (-80.65270 41.07909)
Yuba City, CA                        POINT (-121.63815 39.13575)
Yuma, AZ                             POINT (-114.54868 32.59910)
Name: geometry, Length: 379, dtype: geometry
Code
bufs = []
#city_buffers = gpd.GeoDataFrame()

for i,row in centers.iterrows():
    try:
        record = {'name':row.name}
        print(f"{row.name}")
        geom = gpd.GeoSeries(row.geometry)
        df = Community.from_census(msa_fips=row.geoid, years=[2010]).gdf
        #row = gpd.GeoDataFrame(row)
        geom.crs=4326
        df = project_gdf(df)
        geom = geom.to_crs(df.crs)

        dist,ring=concentrics(df=df, center=geom)
        record['dist'] = dist
        print(dist)
        record['geometry'] = ring.geometry
        bufs.append(gpd.GeoDataFrame(record))
    except:
        pass
city_buffers = pd.concat(bufs, axis=0)
city_buffers.to_file('city_buffers.shp')
Abilene, TX
3000
Akron, OH
5000
Albany, GA
3000
Albany, OR
2000
Albany-Schenectady-Troy, NY
4500
Albuquerque, NM
6000
Alexandria, LA
2500
Allentown-Bethlehem-Easton, PA-NJ
5000
Altoona, PA
2000
Amarillo, TX
3500
Ames, IA
2500
Anchorage, AK
28000
Ann Arbor, MI
2500
Anniston-Oxford-Jacksonville, AL
4500
Appleton, WI
3000
Asheville, NC
5500
Athens-Clarke County, GA
2500
Atlanta-Sandy Springs-Roswell, GA
12000
Atlantic City-Hammonton, NJ
19000
Auburn-Opelika, AL
4000
Augusta-Richmond County, GA-SC
8000
Austin-Round Rock, TX
6500
Bakersfield, CA
4500
Baltimore-Columbia-Towson, MD
5000
Bangor, ME
4000
Barnstable Town, MA
5500
Baton Rouge, LA
5500
Battle Creek, MI
4000
Bay City, MI
2000
Beaumont-Port Arthur, TX
4500
Beckley, WV
3000
Bellingham, WA
2500
Bend-Redmond, OR
3000
Billings, MT
3000
Binghamton, NY
3000
Birmingham-Hoover, AL
6500
Bismarck, ND
2000
Blacksburg-Christiansburg-Radford, VA
3500
Bloomington, IL
3000
Bloomington, IN
1500
Bloomsburg-Berwick, PA
2000
Boise City, ID
4500
Boston-Cambridge-Newton, MA-NH
5500
Boulder, CO
3000
Bowling Green, KY
3000
Bremerton-Silverdale, WA
5500
Bridgeport-Stamford-Norwalk, CT
6000
Brownsville-Harlingen, TX
6000
Brunswick, GA
4000
Buffalo-Cheektowaga-Niagara Falls, NY
5000
Burlington, NC
3000
Burlington-South Burlington, VT
3000
California-Lexington Park, MD
5000
Canton-Massillon, OH
3500
Cape Coral-Fort Myers, FL
6000
Cape Girardeau, MO-IL
3000
Carbondale-Marion, IL
4500
Carson City, NV
2000
Casper, WY
2500
Cedar Rapids, IA
3000
Chambersburg-Waynesboro, PA
2500
Champaign-Urbana, IL
2000
Charleston, WV
4000
Charleston-North Charleston, SC
6500
Charlotte-Concord-Gastonia, NC-SC
8500
Charlottesville, VA
2500
Chattanooga, TN-GA
6000
Cheyenne, WY
2500
Chicago-Naperville-Elgin, IL-IN-WI
8000
Chico, CA
3000
Cincinnati, OH-KY-IN
7500
Clarksville, TN-KY
5500
Cleveland, TN
2500
Cleveland-Elyria, OH
7500
Coeur d'Alene, ID
2500
College Station-Bryan, TX
2500
Colorado Springs, CO
4500
Columbia, MO
2500
Columbia, SC
8500
Columbus, GA-AL
4500
Columbus, IN
2500
Columbus, OH
6500
Corpus Christi, TX
9500
Corvallis, OR
2000
Crestview-Fort Walton Beach-Destin, FL
4500
Cumberland, MD-WV
3000
Dallas-Fort Worth-Arlington, TX
15500
Dalton, GA
3500
Danville, IL
2500
Daphne-Fairhope-Foley, AL
6000
Davenport-Moline-Rock Island, IA-IL
4000
Dayton, OH
Decatur, IL
3000
Deltona-Daytona Beach-Ormond Beach, FL
7500
Denver-Aurora-Lakewood, CO
7500
Des Moines-West Des Moines, IA
5500
Detroit-Warren-Dearborn, MI
9500
Dothan, AL
3000
Dover, DE
4000
Dubuque, IA
2000
Duluth, MN-WI
5500
East Stroudsburg, PA
3500
Eau Claire, WI
3000
El Centro, CA
2500
El Paso, TX
6500
Elizabethtown-Fort Knox, KY
3500
Elkhart-Goshen, IN
3500
Elmira, NY
2000
Enid, OK
2000
Erie, PA
2500
Eugene, OR
3500
Evansville, IN-KY
4000
Fairbanks, AK
4000
Fargo, ND-MN
2500
Farmington, NM
3000
Fayetteville, NC
5000
Fayetteville-Springdale-Rogers, AR-MO
5000
Flagstaff, AZ
4000
Flint, MI
4000
Florence, SC
3000
Florence-Muscle Shoals, AL
3500
Fond du Lac, WI
1500
Fort Collins, CO
3500
Fort Smith, AR-OK
5000
Fort Wayne, IN
4000
Fresno, CA
4000
Gadsden, AL
3500
Gainesville, FL
4000
Gainesville, GA
3000
Gettysburg, PA
4000
Glens Falls, NY
2000
Goldsboro, NC
3500
Grand Forks, ND-MN
2000
Grand Island, NE
2000
Grand Junction, CO
3000
Grand Rapids-Wyoming, MI
5000
Grants Pass, OR
1500
Great Falls, MT
2500
Greeley, CO
3500
Green Bay, WI
4000
Greensboro-High Point, NC
5500
Greenville, NC
3000
Greenville-Anderson-Mauldin, SC
7000
Gulfport-Biloxi-Pascagoula, MS
6500
Hagerstown-Martinsburg, MD-WV
3000
Hammond, LA
3000
Hanford-Corcoran, CA
3000
Harrisburg-Carlisle, PA
4000
Harrisonburg, VA
2000
Hartford-West Hartford-East Hartford, CT
13500
Hattiesburg, MS
3000
Hickory-Lenoir-Morganton, NC
5500
Hilton Head Island-Bluffton-Beaufort, SC
6500
Hinesville, GA
2500
Homosassa Springs, FL
5500
Hot Springs, AR
4000
Houma-Thibodaux, LA
5000
Houston-The Woodlands-Sugar Land, TX
11500
Huntington-Ashland, WV-KY-OH
4500
Huntsville, AL
8000
Idaho Falls, ID
3000
Indianapolis-Carmel-Anderson, IN
7500
Iowa City, IA
2000
Ithaca, NY
2000
Jackson, MI
2500
Jackson, MS
5500
Jackson, TN
3500
Jacksonville, FL
8000
Jacksonville, NC
4000
Janesville-Beloit, WI
2500
Jefferson City, MO
4500
Johnson City, TN
12000
Johnstown, PA
3500
Jonesboro, AR
3500
Joplin, MO
3000
Kahului-Wailuku-Lahaina, HI
2500
Kalamazoo-Portage, MI
4000
Kankakee, IL
3000
Kansas City, MO-KS
8500
Kennewick-Richland, WA
4500
Killeen-Temple, TX
6000
Kingsport-Bristol-Bristol, TN-VA
8000
Kingston, NY
2500
Knoxville, TN
5500
Kokomo, IN
2500
La Crosse-Onalaska, WI-MN
3000
Lafayette, LA
4500
Lafayette-West Lafayette, IN
3000
Lake Charles, LA
67000
Lake Havasu City-Kingman, AZ
4000
Lakeland-Winter Haven, FL
5500
Lancaster, PA
2500
Lansing-East Lansing, MI
4500
Laredo, TX
3000
Las Cruces, NM
3500
Las Vegas-Henderson-Paradise, NV
6500
Lawrence, KS
2000
Lawton, OK
3000
Lebanon, PA
2000
Lewiston, ID-WA
2500
Lewiston-Auburn, ME
2500
Lexington-Fayette, KY
4000
Lima, OH
2000
Lincoln, NE
3000
Little Rock-North Little Rock-Conway, AR
6000
Logan, UT-ID
2500
Longview, TX
4000
Longview, WA
2500
Los Angeles-Long Beach-Anaheim, CA
10000
Louisville/Jefferson County, KY-IN
6500
Lubbock, TX
3500
Lynchburg, VA
3500
Macon-Bibb County, GA
5000
Madera, CA
2500
Madison, WI
4000
Manchester-Nashua, NH
3000
Manhattan, KS
3000
Mankato-North Mankato, MN
3000
Mansfield, OH
2000
McAllen-Edinburg-Mission, TX
5000
Medford, OR
2500
Memphis, TN-MS-AR
6500
Merced, CA
3000
Miami-Fort Lauderdale-West Palm Beach, FL
14000
Michigan City-La Porte, IN
2500
Midland, MI
2000
Midland, TX
3000
Milwaukee-Waukesha-West Allis, WI
4500
Minneapolis-St. Paul-Bloomington, MN-WI
8000
Missoula, MT
2500
Mobile, AL
4000
Modesto, CA
4000
Monroe, LA
4000
Monroe, MI
3000
Montgomery, AL
4000
Morgantown, WV
1500
Morristown, TN
3500
Mount Vernon-Anacortes, WA
3500
Muncie, IN
2000
Muskegon, MI
3000
Myrtle Beach-Conway-North Myrtle Beach, SC-NC
11500
Napa, CA
2000
Naples-Immokalee-Marco Island, FL
18000
Nashville-Davidson--Murfreesboro--Franklin, TN
7500
New Bern, NC
3500
New Haven-Milford, CT
3500
New Orleans-Metairie, LA
14500
New York-Newark-Jersey City, NY-NJ-PA
7000
Niles-Benton Harbor, MI
4500
North Port-Sarasota-Bradenton, FL
17500
Norwich-New London, CT
5000
Ocala, FL
5500
Ocean City, NJ
4500
Odessa, TX
2500
Ogden-Clearfield, UT
5000
Oklahoma City, OK
7000
Olympia-Tumwater, WA
3500
Omaha-Council Bluffs, NE-IA
4500
Orlando-Kissimmee-Sanford, FL
8500
Oshkosh-Neenah, WI
2500
Owensboro, KY
2500
Oxnard-Thousand Oaks-Ventura, CA
6500
Palm Bay-Melbourne-Titusville, FL
6500
Panama City, FL
4500
Parkersburg-Vienna, WV
2000
Pensacola-Ferry Pass-Brent, FL
5000
Peoria, IL
4000
Philadelphia-Camden-Wilmington, PA-NJ-DE-MD
7000
Phoenix-Mesa-Scottsdale, AZ
11500
Pine Bluff, AR
3000
Pittsburgh, PA
6500
Pittsfield, MA
2500
Pocatello, ID
2500
Port St. Lucie, FL
5500
Portland-South Portland, ME
9000
Portland-Vancouver-Hillsboro, OR-WA
7500
Prescott, AZ
Providence-Warwick, RI-MA
9500
Provo-Orem, UT
3500
Pueblo, CO
3000
Punta Gorda, FL
5500
Racine, WI
2500
Raleigh, NC
10000
Rapid City, SD
2500
Reading, PA
2500
Redding, CA
3000
Reno, NV
4500
Richmond, VA
6000
Riverside-San Bernardino-Ontario, CA
12000
Roanoke, VA
4000
Rochester, MN
3000
Rochester, NY
4000
Rockford, IL
3000
Rocky Mount, NC
4000
Rome, GA
3500
Sacramento--Roseville--Arden-Arcade, CA
7000
Saginaw, MI
3500
Salem, OR
3500
Salinas, CA
2500
Salisbury, MD-DE
4500
Salt Lake City, UT
7000
San Angelo, TX
2500
San Antonio-New Braunfels, TX
6500
San Diego-Carlsbad, CA
8000
San Francisco-Oakland-Hayward, CA
10500
San Jose-Sunnyvale-Santa Clara, CA
5000
San Luis Obispo-Paso Robles-Arroyo Grande, CA
6000
Santa Cruz-Watsonville, CA
2500
Santa Fe, NM
3000
Santa Maria-Santa Barbara, CA
4500
Santa Rosa, CA
4000
Savannah, GA
6500
Scranton--Wilkes-Barre--Hazleton, PA
4000
Seattle-Tacoma-Bellevue, WA
9500
Sebastian-Vero Beach, FL
3500
Sebring, FL
5000
Sheboygan, WI
2500
Sherman-Denison, TX
4500
Shreveport-Bossier City, LA
4000
Sierra Vista-Douglas, AZ
5500
Sioux City, IA-NE-SD
3500
Sioux Falls, SD
3000
South Bend-Mishawaka, IN-MI
3500
Spartanburg, SC
4500
Spokane-Spokane Valley, WA
4500
Springfield, IL
3000
Springfield, MA
4500
Springfield, MO
4000
Springfield, OH
2500
St. Cloud, MN
3500
St. George, UT
4000
St. Joseph, MO-KS
2500
St. Louis, MO-IL
8000
State College, PA
1500
Staunton-Waynesboro, VA
3000
Stockton-Lodi, CA
4000
Sumter, SC
3000
Syracuse, NY
3500
Tallahassee, FL
4500
Tampa-St. Petersburg-Clearwater, FL
13500
Terre Haute, IN
3000
Texarkana, TX-AR
3500
The Villages, FL
1500
Toledo, OH
4500
Topeka, KS
3500
Trenton, NJ
6000
Tucson, AZ
7500
Tulsa, OK
5500
Tuscaloosa, AL
4500
Tyler, TX
3000
Urban Honolulu, HI
3500
Utica-Rome, NY
5500
Valdosta, GA
2500
Vallejo-Fairfield, CA
4000
Victoria, TX
2000
Vineland-Bridgeton, NJ
3000
Virginia Beach-Norfolk-Newport News, VA-NC
7500
Visalia-Porterville, CA
3500
Waco, TX
3500
Walla Walla, WA
2000
Washington-Arlington-Alexandria, DC-VA-MD-WV
8000
Waterloo-Cedar Falls, IA
3500
Watertown-Fort Drum, NY
3500
Wausau, WI
4000
Weirton-Steubenville, WV-OH
4000
Wenatchee, WA
2500
Wheeling, WV-OH
4000
Wichita Falls, TX
4000
Wichita, KS
4500
Williamsport, PA
2500
Wilmington, NC
3500
Winchester, VA-WV
3000
Winston-Salem, NC
6000
Worcester, MA-CT
4000
Yakima, WA
3000
York-Hanover, PA
3000
Youngstown-Warren-Boardman, OH-PA
5000
Yuba City, CA
3000
Yuma, AZ
10500
Code
centers = centers.set_geometry('geometry')
Code
city_buffers
Code
record
{'name': 'Albany, GA'}
Code
bufs
Code
gpd.GeoDataFrame(pd.concat(bufs)).plot()

:::