This release is a pre-release and may not be stable for production use.
Not an official source of place names or boundaries. Full terms: DISCLAIMER.md
TL;DR: the free way to turn a GPS point into a place name is "find the nearest big city within some radius", which is how a photo taken on the Canadian side of Niagara Falls ends up in Buffalo, New York, and a boat on Lake Ontario ends up in Rochester. The good way is Google's Geocoding API, which is lovely until you look at the bill: roughly $5 per 1,000 points, so naming one 100k-photo library costs about $500, a location history of a few hundred thousand points about $1,000, and you pay again every time the data changes, while every place you have ever been goes to Google. placewise is the third option: the answer a person would give, computed on your own machine, for free.
Status
By the numbers
Measured with benchmarks/bench.py on a 2019 laptop (Intel i7-9750H, one
thread, Python 3.14), placewise 0.1.0a2, data 2026.11.1. Run it on your own packs to compare.
Speed
| World pack only | All 14 packs | |
|---|---|---|
| First lookup in a fresh process | 0.25 s | 6.1 s (0.7 s with world + usa + can + ind) |
| One lookup after that (median / p95) | 2.7 / 3.6 ms | 12 / 20 ms |
Batch, lookup_many, points near cities |
11,700 points/s | 1,400 points/s; 11,900 with near=False |
| Batch, points anywhere on the globe | 15,400 points/s | 4,100 points/s; 15,300 with near=False |
Search, find (median / p95, 364 queries) |
3.4 / 19 ms | |
Type-ahead, suggest (median / p95) |
9.8 / 37 ms | |
| Peak memory | 370 MB | 2.0 GB at first lookup; 6 GB during 100k-point batches |
With every pack installed most of the time goes to near: distances to the nearest park, lake,
landmark and postcode outline. near=False skips it when only the containing places are needed.
First lookups are slower with the parks and water packs because their distance indexes are built
on first use (making that lazy by region is planned).
Accuracy (tests/e2e, real packs, public places only)
- Search: 99.7% top-1, 100% top-3 on 364 queries: cities, airports by code, parks, landmarks,
postcodes, typos, old names (Bangalore, Gurgaon), context (
"Paris", country="US"). The one miss is Manali (the Chennai suburb outranks the hill station). - Reverse lookup: 137 hand-checked points, plus 33 border and island points (Niagara Falls on both sides, Detroit/Windsor, Point Roberts, Derby Line/Stanstead, Raxaul/Birgunj, Treasure Island, Alcatraz, Mackinac): all correct.
- India: state lines agree with an independent reference for 99.7% of points, districts 85%.
- 4,496 unit tests and 833 end-to-end checks.
Data (1.74 million features in 14 packs: 650 MB on disk, 228 MB to download; the base is 49 MB on disk, 14 MB to download)
| Cities (world) | 172,034 | Postcodes, 116 countries | 867,468 |
| Notable places | 177,600 | US ZIP Code areas | 33,791 |
| Park outlines (US, Canada, Europe) | 203,790 | India PIN-code areas / post offices | 19,628 / 100,138 |
| US places / counties | 32,629 / 3,235 | Canadian municipalities / named places | 5,161 / 25,906 |
| Town outlines (GHS-SMOD) | 39,220 | Lakes / named reservoirs | 4,659 / 1,222 |
| Airports | 6,146 | Disputed areas (worldviews) | 99 |
Code: about 35,000 lines of Python, NumPy the only runtime dependency, Python 3.10+.
Coverage
Detailed data is built for the United States, Canada and India. Everywhere else is covered by world-wide datasets, so answers are sensible but coarser. ●●● official boundaries at full detail · ●● good, approximate in places · ● basic (nearest point or coarse outline) · — not available.
| Layer | United States | Canada | India | Europe & UK | Asia-Pacific | Latin America & Caribbean | Africa & Middle East |
|---|---|---|---|---|---|---|---|
| Country | ●●● | ●●● | ●●● | ●● | ●● | ●● | ●● |
| State / province (admin1) | ●●● Census | ●●● StatCan | ●●● states from PIN + LGD | ●● Natural Earth 1:10m | ●● | ●● | ●● |
| County / district (admin2) | ●●● Census counties | ●●● census divisions | ●● districts (LGD, from PIN areas) | — | — | — | — |
| City / locality | ●●● incorporated places + CDPs, ZIP postal city | ●●● municipalities + named places (CGNDB) | ●● city corporations / ULBs (from PIN areas) | ●● town outline (GHS-SMOD, optional pack world-towns) or nearest GeoNames city |
●● | ●● | ●● |
| Neighbourhood | ●● GeoNames sections | ●● CGNDB neighbourhoods | ●● post-office areas | ● GeoNames sections | ● | ● | ● |
| Metro / region | ●●● metro areas (CBSA/CSA) + curated (Bay Area …) | ●●● CMAs + curated (GTA, GTHA …) | ●● curated (Delhi NCR, MMR, BMR) | — | — | — | — |
| Postal code | ●●● ZIP areas (ZCTA), optional pack usa-zip |
●● FSA (first 3 characters) | ●●● PIN-code areas | ● nearest GeoNames postcode point, optional pack world-postal (UK: outward codes) |
● | ● | ● (few countries) |
| Time zone | ●●● by county | ●●● by division | ●●● | ●● by admin1 | ●● | ●● | ●● |
| Parks & protected areas | ●●● NPS, USFS, state (PAD-US); city and county parks: optional pack usa-parks-local |
●●● CPCAD (no city parks) | ● Wikidata points ("near" only) | ●●● EEA nationally designated areas, 35 countries (no UK), optional pack eur-parks |
● Wikidata points | ● | ● |
| Lakes, rivers, seas | ●● Natural Earth + HydroLAKES + Global Dam Watch reservoirs ≥ 10 km² | ●● | ●● (many lakes unnamed) | ●● | ●● | ●● | ●● |
| Airports | ●●● OurAirports + city served | ●●● | ●●● | ●●● | ●●● | ●●● | ●●● |
| Notable places | ●●● ~38k (Wikidata) | ●● ~4k | ●● ~12k | ●●● | ●● | ●● | ● |
| Search (name → place) | ●●● every layer above | ●●● | ●●● incl. old names (Bangalore, Gurgaon) | ●● cities, admin1, water, parks, landmarks | ●● | ●● | ●● |
Worldviews: the default is de facto (who administers the ground); worldview="IN" answers India,
with its state, for every area India claims; "CN" puts Taiwan, Hong Kong and Macau in China
(docs/worldviews.md).
Current limitations
- Outside the US, Canada and India the city is the nearest notable GeoNames place, not a municipal
boundary, and state lines are Natural Earth's 1:10m outlines (a few hundred metres off at borders;
where a US, Canadian or Indian pack's state or province holds the point, it decides the country:
Niagara Falls, New York; Treasure Island; Petrapole,
docs/naming.md). - India's districts and cities are unions of PIN-code areas: state lines agree with an independent reference 99.7% of the time, districts 85%; large fringe PIN areas can fall outside a city, and satellite cities (Salt Lake → Bidhannagar) aren't rolled up yet. India has no open park outlines.
- Canada's postal data stops at the FSA (M5V); full six-character postcodes aren't open data.
- Lakes under 10 km² and rivers below Natural Earth's detail are missing; HydroLAKES names are sparse outside North America.
- Parks outside the US, Canada and Europe are points with a radius, so they're "near", never "within"; Europe's outlines skip the UK and Türkiye, and some national parks keep their local-language name.
- Search ranks well-known places first; very small or ambiguous names may need a
country=ornear=hint. English names only. - No street addresses or house numbers (not a goal).
Planned
- India: town and village points, satellite-city roll-ups, more metro regions (HMDA, CMDA, PMRDA), park outlines if an openly licensed source appears.
- US and Canada: county subdivisions (New England towns), city neighbourhood polygons from open city portals, smaller lakes.
- World: municipal outlines where an openly licensed global source allows (geoBoundaries), a fame signal for towns so search ranks famous small places (Manali) over bigger namesakes, park outlines for the UK.
- Speed: build the parks and water distance indexes lazily by region, so a full install's first lookup and nearby search get closer to the core packs' speed.
- A few more countries at full depth only where the government data is as good and stable as the US and Canada's (candidates: New Zealand, Australia, UK).
Why
Most offline geocoders (and many apps built on GeoNames) label a point with the nearest place above some population inside a radius. It's simple and it's wrong in ways people notice immediately:
| Point | Nearest-city radius answer | placewise | Why the radius gets it wrong |
|---|---|---|---|
| Fort Erie, Ontario | Buffalo, New York (country: Canada) | Fort Erie, Ontario, Canada | City and country come from opposite sides of the border |
| The Las Vegas Strip | Paradise | Las Vegas (in Paradise CDP) | Legally correct, but nobody says Paradise |
| Emeryville, California | Oakland | Emeryville | A small incorporated city next to a big one |
| Toronto Pearson airport | Toronto | at YYZ, Mississauga | No airport awareness; the airport isn't in Toronto |
| Gurugram, Haryana | Delhi, state Delhi | Gurugram, Haryana · Delhi NCR | The nearest place is across a state line |
| A boat on Lake Ontario | Rochester, 50 km away | On Lake Ontario | Water has no cities, so the radius reaches for one |
| Mid-Atlantic, 50 N 30 W | a town 1,176 km away | On the North Atlantic Ocean (Over, given a flight's altitude) | Same, but worse |
| Yosemite Valley | Yosemite Valley | Yosemite Valley · Yosemite National Park | No park layer |
And the alternatives:
| Option | Cost | Catch |
|---|---|---|
| Google Geocoding API | ~$5 per 1,000 requests after a small free allowance | Every coordinate goes to Google; terms restrict storing and reusing results |
| Mapbox, HERE, OpenCage, LocationIQ | Cheaper than Google, still metered | Coordinates leave your machine; storage terms vary; rate limits for bulk history |
| Self-hosted Nominatim / Photon / Pelias | Free | ~1 TB of disk and 64 GB+ of RAM for the planet, hours to import, ops work; "city" follows OSM tagging |
| reverse_geocoder and similar | Free, tiny | The same nearest-city radius as above |
| placewise | Free; code under 1 MB, data packs of tens of MB per region | No street addresses or house numbers (not a goal); English names only for now |
placewise works from real boundaries (municipalities, counties, census areas, postal areas, water bodies, parks) built from open government and open-data sources, and only falls back to "nearest city" where nothing better exists. Every answer says which dataset and rule produced it, and you can override any of it.
It is built for everyone from someone who just wants their Yosemite photos labelled to GIS professionals: plain words on the simple path, precise terms (EPSG codes, ellipsoids, error bounds) one step away.
Quick start
import placewise
r = placewise.lookup(43.6426, -79.3871) # downloads the world pack on first use
r.label # "Toronto, Ontario, Canada"
r.admin1.codes, r.tz, r.airport # ISO codes, "America/Toronto", Nearby(YTZ, 1.8 km)
placewise.Geocoder().lookup_many(lats, lons) # vectorised: 1,400 to 15,000 points/s (By the numbers)
r = placewise.lookup(36.1147, -115.1728) # fetches the usa pack first (auto mode): the Las Vegas Strip
r.locality.name, r.sublocality.name # "Las Vegas", "Paradise" (the census place)
r.postal.name, r.admin2.name # "89109", "Clark County"
placewise.lookup(35.9208, 74.3089, worldview="IN").label # "Gilgit, Ladakh, India" (docs/worldviews.md)
placewise.find("Yosemite")[0] # Entity: place, a point inside it, bbox, radius, context
placewise.find("Paris", country="USA")[0] # Paris, Texas; also state=, near=, within=, kinds=
placewise.find("YYZ")[0].place.name # "Toronto" (the city it serves); kinds="airport" for the airport
placewise.get("census:0646870") # by id; placewise.suggest("Mississ") for type-ahead
from placewise.text import parse_location
parse_location("US-CA-Menlo Park; Remote - US and Canada") # structured places, offline
print(r) shows a readable card (the label and coordinates, then one aligned line per field with
its source; r.card() adds colour on a terminal, Jupyter shows a table); repr(r) stays exact.
From the command line: placewise lookup 43.6426 -79.3871 prints the card (--json,
--worldview IN, --packs DIR), placewise lookup --csv points.csv --out named.csv names a
whole file (lat/lon columns; --lat-column, --lon-column), and placewise find "Lake Tahoe"
prints a card per place found (--json for Entities).
The same lookups run as a local service or a self-hosted web server (placewise serve, see
docs/self-hosting.md), with placewise.Client offering the identical interface.
What it does
- Forward search (
docs/search.md): names, aliases, codes (IATA, postal, ISO, Wikidata), typos and prefixes to places with a point inside, box, radius, outline and context; context from the text ("Paris, TX") or arguments (country, state, near, bbox, within, kinds). - Reverse lookup (
docs/naming.md): three names per point (sublocality, locality, city), county or district, metro and curated regions, postal area, time zone (by polygon), nearest airport, water body (docs/water.md), parks (docs/parks.md), with the source of every field. - Worldviews (
docs/worldviews.md): de facto by default; per-country views (e.g.IN,CN) and an operator lock for services that must follow one country's map. - Overrides (
docs/overrides.md): rename, relabel, add or hide places, from the repo, your app or a local file. - Location search (
docs/text-parsing.md): parse messy place strings ("Greater Toronto Area", "Remote - EMEA", "Bengaluru (BLR)") into structured places, with filters that explain themselves. - Countries and groups (
docs/world.md):placewise.worldfor countries, subdivisions, 72 country groups with dated memberships (EU, Schengen, NATO, EMEA ...) and country profiles.
Geo toolkit (placewise.geo), no data needed
from datetime import date
from placewise import geo
geo.distance(43.6532, -79.3832, 45.5019, -73.5674) # km, haversine
geo.distance(43.6532, -79.3832, 45.5019, -73.5674, method="geodesic") # Karney, WGS84
geo.initial_bearing(43.65, -79.38, 45.50, -73.57) # degrees
geo.destination(43.65, -79.38, bearing=45, distance_km=10)
geo.parse("43°38′33.2″N 79°23′13.4″W") # also Google/Apple/OSM URLs
geo.to_utm(43.6426, -79.3871) # also UPS, MGRS, ECEF, ENU
geo.plus_code_encode(43.6426, -79.3871)
geo.sun_times(43.6426, -79.3871, date(2026, 6, 21))
Also: geohash, map tiles and quadkeys, encoded polylines, line simplification, nearest point on a
line, spherical areas, antimeridian-aware bounding boxes, a two-stage polygon index for detailed
GeoJSON or shapefile boundaries, and a registry of every coordinate system used with its EPSG code
(placewise.constants.crs).
Tracks (placewise.tracks, placewise.io)
from placewise.tracks import Track
track = Track.read("ride.fit") # GPX, FIT, TCX, KML/KMZ, GeoJSON, NMEA or CSV, detected from content
track = track.clean() # sort, dedupe, drop invalid fixes, remove spikes, split gaps
track.stats() # distance, moving time, elevation gain, speeds, heart rate
track.position_at(photo_times) # where you were at each time (great-circle interpolation)
track.stays() # places you stopped, with gap bridging
Readers and writers need no dependencies (FIT is decoded from the public spec). Operations include Kalman smoothing, thinning, resampling, splits and best efforts, camera clock-offset estimation for photo geotagging, trips, travel modes, flights, time inside an area, border crossings, days per country, merging recordings from several devices, and route comparison (Hausdorff, Fréchet, corridor overlap, deviations).
Privacy (placewise.privacy)
from placewise import privacy
key = b"..." # at least 16 secret bytes, kept and reused
shared = privacy.apply(track, privacy.preset("public_share"), key)
Privacy zones whose cut points don't give away the hidden place, secret-length trimming, keyed grid snapping, geo-indistinguishable noise, time coarsening, and an audit of what a track reveals. Every tool documents what it does not protect against.
Data
The base install is just the world pack (about 10 MB to download, 50 MB on disk), installed on first use. Everything else is a pack you add, by hand or on demand:
placewise data status # mode, installed packs and their size on disk, what auto mode fetches
placewise data mode # how packs arrive: manual (default), auto or locked
placewise data mode locked # never download anything (written to placewise.toml)
placewise data mode auto --kinds country,parks,water # auto mode may fetch these kinds of pack
placewise data install usa # download, verify and install a pack (and any it requires)
placewise data list # installed and available packs, every version
placewise data update # newer versions (never automatic, never deletes)
placewise attribution # the installed packs' sources, licences and credits (--all, --short)
Modes (data.mode in placewise.toml, PLACEWISE_DATA_MODE, placewise data mode):
- auto (opt in with
placewise data mode auto): the first lookup batch with points in the US installsusa, a point in Canadacan, and so on, once, before the batch runs, with a log line naming the pack and its size. Only the kinds indata.auto_packsare fetched, by defaultcountrypacks, the ones that change the main answer (city, county, metro area, postal code). Addparks,water,notable,postalortownsto fetch those too (PLACEWISE_DATA_AUTO_PACKS=country,parks). A search that asks for a kind (find("Banff", kinds="park", country="CA")) fetches that kind's packs for its country (can-parks) even when it isn't inauto_packs. Installed packs are used straight away; a lookup that needs nothing new doesn't download anything (auto mode plans from the cached index, fetching a fresh one only when that is over a week old). Fetching a country pack does tell the download host which country you looked up; choosemanualorlockedif that matters to you. - manual (the default): packs arrive only with
placewise data install; the world pack still installs on first use. A lookup that a missing pack would improve logs once which pack to install. - locked: never download anything, not even the index; use exactly what is installed (a
missing world pack is an error).
--offlineanddata.offline = true(the older spelling) mean locked whatever the mode. Servers and read-only deployments should run locked.
The default keeps the base lean: only the world pack until you install more. Auto mode with its default kinds fetches only country packs, and only for the countries you look up. Sizes for the 2026.11 data on disk:
| Pack | On disk | What it adds |
|---|---|---|
world (base) |
49 MB | countries, states/provinces, 172k cities, airports, time zones, worldviews, search |
usa |
69 MB | states, counties, places, metro areas, ZIP postal cities |
can |
88 MB | provinces, divisions, municipalities, metro areas, FSAs, named places |
ind |
68 MB | states, districts, cities, PIN-code areas, post offices, neighbourhoods |
usa-zip |
53 MB | US ZIP Code areas (without it US points have no postal code) |
usa-parks |
63 MB | national, state and regional parks and forests (PAD-US) |
usa-parks-local |
42 MB | city and county parks |
can-parks |
18 MB | protected and conserved areas (CPCAD) |
eur-parks |
38 MB | park outlines in 35 European countries (EEA) |
world-parks |
2 MB | national parks and reserves elsewhere, as points |
world-water |
52 MB | seas, rivers, lakes ≥ 10 km², named reservoirs, surface elevations |
world-notable |
46 MB | 177k landmarks, stations, universities, stadiums |
world-postal |
57 MB | postcode points in 116 countries outside the US, Canada and India (docs/postal.md) |
world-towns |
8 MB | town and city outlines outside the US, Canada and India (GHS-SMOD) |
Everything together is about 650 MB; the US, Canada and India core (world, usa, can, ind)
about 275 MB. placewise data status shows the current ones.
Everything placewise downloads lives in ~/.placewise/ unless configured otherwise (--data-dir,
PLACEWISE_DATA_DIR or data.data_dir in placewise.toml; placewise data where prints it).
Packs are memory-mapped and checksummed (format: docs/pack-format.md). Data sources are listed in
src/placewise/sources/, one JSON file per purpose (boundaries, places, regions, postal codes,
airports ...) giving the sources used in each region, and ATTRIBUTION.md is generated from them,
so an app that ships placewise data can link to that one file.
Packs are published as release assets of amolvenkataraman/placewise-data (index.json plus one
.tar.xz per pack); any copy of a release's files works as a mirror (--index-url, data.mirrors).
Conventions
- Coordinates are WGS84 degrees, always in
(lat, lon)order (GeoJSON uses(lon, lat)). - Every function accepts scalars or numpy arrays and broadcasts; scalars in, plain floats out.
- Distances are kilometres unless a name ends in
_m. - English names only; standard coordinate systems only (no obfuscated ones like GCJ-02).
Licence
The code is licensed under the Apache License 2.0 (see also NOTICE). The data
packs keep their sources' licences (ATTRIBUTION.md); placewise's own curated datasets, in the
placewise-data repository, are CC BY 4.0.
Disclaimer
placewise and its data packs are provided "as is" and "where is", with no warranty of any kind and no legal liability for their use. Names, boundaries and other data may be wrong or out of date and are not an official determination of any territory's status. See DISCLAIMER.md.
Development
uv sync # creates .venv with the dev tools
uv run pytest # tests
uv run ruff check . # lint
uv run ruff format . # format
Requires Python 3.10+. The runtime depends on numpy only; pip install placewise[geodesic] adds
GeographicLib for ellipsoidal distances. packbuild/ (not shipped) turns public datasets into packs.
Metadata
Release files for placewise 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| placewise-0.1.0a2.tar.gz | 1.4 MB | Without provenance | Details for placewise-0.1.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| placewise-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details for placewise-0.1.0a2-py3-none-any.whl |
Total release size: 2.0 MB
Release files / placewise-0.1.0a2.tar.gz
| Download URL | placewise-0.1.0a2.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87a104c6ffe2d551dba0f26dc7910dff00c2dda6bf263b5b8a5999b688d140d2
|
|
BLAKE2b-256 checksum How to use checksums |
987ea0c27e17130d0850564194bf1f065793420330522f9d1a67e606004c4cee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / placewise-0.1.0a2-py3-none-any.whl
| Download URL | placewise-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 646.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df3e18d2e32000ce52c0f0e59237dd9182b6cc3972d6de088f4ef346acc7e4c3
|
|
BLAKE2b-256 checksum How to use checksums |
da02d8e9c02c166841686981770c13ec989447cc4128d3f7de6f8832b67f2295
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for placewise 0.1.0a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.