1
$\begingroup$

I am interested in using Entity Functions such as EntityValue, FilteredEntityClass, EntityFunction, EntityClass, EntityList, and GeoEntities to help me find N most populous cities in each state. I have figured out how to calculate the most populous cities in 1 state, but when I try to scale it to all 50 states it takes a really long time. I found a similar question about how to find to the twenty most populous cities. I am thinking of applying Map to the function CityData for each state and then applying a function to get the N number of most populous cities for each state to the result of the first mapping.

EntityList[
 EntityClass[
  "City", {EntityProperty["City", "AdministrativeDivision"] -> 
    Entity["AdministrativeDivision", {"California", 
      "UnitedStates"}]}]]

returns

{}

and

GeoEntities[
 Entity["AdministrativeDivision", {"Alaska", "UnitedStates"}], "City"]

returns

GeoEntities::servermessage: Server message: Internal server error.

My goal is to first find a way to find the most populous cities in a state and then map that function to all 50 states. My broader interest is in applying Mathematica to geographical computation.

$\endgroup$
2
  • 2
    $\begingroup$ Could you please include representative code that you have tried out so far? $\endgroup$
    – Syed
    Nov 5, 2021 at 13:30
  • $\begingroup$ Please include your code, not a picture of it, so respondents can paste it in their notebooks. And exactly where were you thinking about using Map on all this? You said you could find the most populous city in one state but the code you have shown presents no such output. $\endgroup$
    – Syed
    Nov 5, 2021 at 14:23

0

Your Answer

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

Browse other questions tagged or ask your own question.