geo
facts about countries and cities, and distances and directions between places
Permissions: network, cache
Built-in facts about the world’s countries and cities, and distances and directions between places.
The functions here look up countries by name or by their two- or three-letter ISO code, and cities by name. Short names and missing accents are fine. When several cities share a name the biggest one wins, so add a country or state after a comma to pick another, like "Portland, US".
Where a function takes a place, give a city or country name (a country means its capital), or a map with lat and lon.
good to know
Section titled “good to know”A place’s name also works with to as a currency, so $100 to "Vietnam" gives dong, and as a time zone.
City and country data comes from GeoNames (geonames.org, CC-BY 4.0) and covers capitals and cities of over 500,000 people.
Tags: geometry
countryfacts about a country, found by name or ISO codecityfacts about a citycountriesevery country, as a table with the same columns as country givescitiesevery city, as a table with the same columns as city gives, biggest firstgreat_circlethe distance between two places along the Earth’s surface, the shortest route, which is roughly the one planes flybearingthe compass direction to set off in from one place to reach another, in degrees clockwise from north (90 is east)nearestthe city closest to a latitude and longitude, out of those zil knowszipcodelook up a postal code online
syntax
Section titled “syntax”1# countries by name or ISO code2country("JPN").name"Japan"3# short names and missing accents work4[city("NYC").name, city("Sao Paulo").name]["New York City", "São Paulo"]5# add a country or state to pick another6city("Hyderabad, PK").country"Pakistan"7# a place can also be a map with lat and lon8great_circle("Paris", {lat: 0, lon: 0})5436.93 kmFunctions
Section titled “Functions”country
Section titled “country”country(name: str) -> map
facts about a country, found by name or ISO code
Its name, two- and three-letter codes, capital, currency, time zones, phone calling code, population, area, continent, flag, languages and neighbours
1country("Japan"){name: "Japan", code: "JP", code3: "JPN", capital: "Tokyo", currency: "JPY", zones: ["Asia/Tokyo"], calling: "+81", population: 126529100, area: 377835 km^2, continent: "Asia", flag: "🇯🇵", languages: ["ja"], neighbours: []}2country("UK").currency"GBP"city(name: str) -> map
facts about a city
Its name, country, state or region (admin), population, latitude and longitude, and time zone
1city("Tokyo"){name: "Tokyo", country: "Japan", admin: "Tokyo", population: 9733276, lat: 35.6895, lon: 139.692, zone: "Asia/Tokyo"}2city("Seattle").zone"America/Los_Angeles"See also country, cities, nearest
countries
Section titled “countries”countries() -> table
every country, as a table with the same columns as country gives
1countries().len2522countries().filter(|c| c.continent == "Oceania").map(|c| c.name).take(3)["American Samoa", "Australia", "Cook Islands"]cities
Section titled “cities”cities() -> table
every city, as a table with the same columns as city gives, biggest first
1cities()[0].name"Shanghai"great_circle
Section titled “great_circle”great_circle(from: str|map, to: str|map) -> quantity
the distance between two places along the Earth’s surface, the shortest route, which is roughly the one planes fly
1great_circle("Tokyo", "Paris")9712.52 km2great_circle("NYC", "LA") to mi2445.56 mibearing
Section titled “bearing”bearing(from: str|map, to: str|map) -> quantity
the compass direction to set off in from one place to reach another, in degrees clockwise from north (90 is east)
1bearing("NYC", "London")51.2117 degSee also great_circle
nearest
Section titled “nearest”nearest(lat: num, lon: num) -> map
the city closest to a latitude and longitude, out of those zil knows
1nearest(48.9, 2.3).name"Paris"See also city, great_circle
zipcode
Section titled “zipcode”zipcode(code: str, country: str = “US”) -> map
look up a postal code online
Codes looked up before work offline. Gives its place name, state, country, latitude and longitude. The result works as a place for great_circle
1zipcode("90210").place2zipcode("10115", "Germany")3great_circle(zipcode("10001"), zipcode("94103")) to miSee also city
More examples
Section titled “More examples”1# currency of a country2country("Vietnam").currency"VND"3# time in any city4date("2026-12-25 18:30") to "Seattle"2026-12-25 16:30:00 -08:005# flying distance from New York to London6great_circle("New York", "London") to mi3461.18 mi7# which compass direction Mecca is from London8bearing("London", "Mecca")118.988 deg9# sunset in a city10sunset("Oslo", date(2026, 6, 21))2026-06-21 15:43:43 -05:0011# how many countries use the euro12countries().filter(|c| c.currency == "EUR").len3613# biggest cities in Japan14cities().filter(|c| c.country == "Japan").map(|c| c.name).take(3)["Tokyo", "Yokohama", "Osaka"]Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.