4

I like to use Mathematica to answer questions related to cities such as how many cities in the United States have a population greater than 100,000 and what the distribution of them would look like on a map of the continental US.

I have run into an issue downloading the values of all 175,000 cities every time I query CityData or Entity of type City. It often takes 10 to 30 minutes for one line of code to run, such as:

citiespopulationbiggerthanhundredthousand = 
 EntityList[
  FilteredEntityClass["City", 
   EntityFunction[c, c["Population"] >= Quantity[100000, "People"]]]]

I am wondering if there is a way to reduce the wait time using EntityPrefetch, caching, or preloading the data. I have preloaded the data for CityData but when I ran the above code it had to re-download all. I have also tried using EntityPrefetch for CityData. I have found that running RebuildPacletData[] caches the data for offline use. I also would like to extend this to other types of entities, such as "Aircraft" or "Countries".

Peter Burbery
  • 1,695
  • 4
  • 15

0 Answers0