1
$\begingroup$

Preamble

Run this code in the preamble for a working example of what I'm dealing with.

Census Tract Entity Store

ResourceData[ResourceObject["Census Tract Entity Store"]]; // Quiet
EntityRegister[ResourceData[ResourceObject["Census Tract Entity Store"]]]; // Quiet

Function Declaration

f[x_] := EntityValue[EntityClass["CensusTract", "ADM2" -> x], 
   EntityProperty["CensusTract", "B19013_001E"], "Association"] // 
  Quiet

List of Counties

Click here for Pastebin of list of counties. You have to run this code in order for this example to work.

Question

Take a look at the following line of code. It generates a map of the census tracts in the DMV area, colored by income. When I run it, having run all the code above first, I am seeing that D.C. and Baltimore are blank. See the areas I'm talking about circled in blue in the figure below. (I added the blue circles after the fact)

GeoRegionValuePlot[<|Map[f, dmvCounties]|>, ImageSize -> 500]

Output

My question is: why are D.C. and Blatimore blank? How can I include them in this map as well?

$\endgroup$

1 Answer 1

2
$\begingroup$

If you look at the output of Map[f, dmvCounties], you can see that there are several counties where the value is Null or Missing.

a = <|Map[f, dmvCounties]|>

Sort[a][[-50 ;;]]

enter image description here

I don't see DC in the output but it does look like there's a "Baltimore County" value that is null. Another way to have a look is by just plotting all the keys:

GeoListPlot[Keys@a, PlotStyle -> Blue]

enter image description here

Clearly something missing.

A final check is to simply run f on the entities you are missing:

GeoRegionValuePlot@
 f[Entity["AdministrativeDivision", {"BaltimoreCounty", "Maryland", 
    "UnitedStates"}]]

enter image description here

while f@Entity["City", {"Washington", "DistrictOfColumbia", "UnitedStates"}] just returns <||>.

Sorry I don't have a solution as to how you can include them, but the why seems that there may be no data in the dataset for those Entities.

$\endgroup$
2
  • $\begingroup$ Hmm. I wonder if it has anything to do with the ADM2 specification in my function declaration... Could it be that these metropolitan areas are ADM1 or ADM3? I tried to replace these entity classes, but nothing returned! $\endgroup$ Commented Sep 27, 2020 at 19:21
  • 1
    $\begingroup$ That definitely seems plausible to me. I would guess the issue is related to them being large metropolitan areas, but I really couldn't say beyond that! $\endgroup$
    – Carl Lange
    Commented Sep 27, 2020 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.