Wolfram Language

External Services

Compare How Vegan-Friendly Two Cities Are

Connect to the Factual API to get information about locations.

In[1]:=
Click for copyable input
factual = ServiceConnect["Factual"]
Out[1]=

Look for vegan and vegetarian food locations in two cities.

In[2]:=
Click for copyable input
resultsSeattle = factual["PlacesDataset", "Locality" -> Entity["City", {"Seattle", "Washington", "UnitedStates"}], "Query" -> "Vegan and vegetarian food", MaxItems -> 300]; resultsHonolulu = factual["PlacesDataset", "Locality" -> Entity["City", {"Honolulu", "Hawaii", "UnitedStates"}], "Query" -> "Vegan and vegetarian food", MaxItems -> 300];

Get the number of locations and density.

show complete Wolfram Language input
In[3]:=
Click for copyable input
TextGrid[{{"City", "Area", "Number of locations", "Density"}, {Entity[ "City", {"Seattle", "Washington", "UnitedStates"}], Entity["City", {"Seattle", "Washington", "UnitedStates"}]["Area"], Length[resultsSeattle], Length[resultsSeattle]/ Entity["City", {"Seattle", "Washington", "UnitedStates"}][ "Area"]}, {Entity[ "City", {"Honolulu", "Hawaii", "UnitedStates"}], Entity["City", {"Honolulu", "Hawaii", "UnitedStates"}]["Area"], Length[resultsHonolulu], Length[resultsHonolulu]/ Entity["City", {"Honolulu", "Hawaii", "UnitedStates"}]["Area"]}}, Frame -> All]
Out[3]=

Related Examples

de es fr ja ko pt-br ru zh