@@ -77,16 +77,23 @@ def _preprocess_variables(self, columns):
77
77
@property
78
78
def _layer_lookup (self ):
79
79
"""
80
- The lookup table relating the layers in the WMS service and the levels
81
- supported by this API product.
80
+ Create lookup table to translate cenpy levels ('county', 'block',
81
+ 'tract') to layer id. Dynamically create to handle year to year id
82
+ changes (naming changes will break)
82
83
"""
83
- pass
84
84
85
- @_layer_lookup .getter
86
- def _layer_lookup (self ):
87
- raise NotImplementedError (
88
- "This must be implemented on children " "of this class!"
89
- )
85
+ supported_levels = {
86
+ 'States' : 'state' ,
87
+ 'Counties' : 'county' ,
88
+ 'Census Blocks' : 'block' ,
89
+ 'Census Tracts' : 'tract' ,
90
+ }
91
+
92
+ return {
93
+ supported_levels [l ._name ]: l ._id
94
+ for l in self ._api .mapservice .layers if
95
+ l ._name in ['Counties' , 'Census Tracts' , 'Census Blocks' ]
96
+ }
90
97
91
98
def from_place (
92
99
self ,
@@ -480,8 +487,6 @@ def check_match(
480
487
class Decennial2010 (_Product ):
481
488
"""The 2010 Decennial Census from the Census Bueau"""
482
489
483
- _layer_lookup = {"county" : 100 , "tract" : 14 , "block" : 18 }
484
-
485
490
def __init__ (self ):
486
491
super (Decennial2010 , self ).__init__ ()
487
492
self ._api = APIConnection ("DECENNIALSF12010" )
@@ -673,8 +678,6 @@ def crosstab_tables(self):
673
678
class ACS (_Product ):
674
679
"""The American Community Survey (5-year vintages) from the Census Bueau"""
675
680
676
- _layer_lookup = {"county" : 84 , "tract" : 8 }
677
-
678
681
def __init__ (self , year = "latest" ):
679
682
self ._cache = dict ()
680
683
if year == "latest" :
0 commit comments