Gazetteer#
Public gazetteer query interface.
A Gazetteer wraps an installed artifact (a self-contained, read-only SQLite file) and exposes name search and identifier lookup over its features.
- class Gazetteer(gazetteer_name: str)#
Bases:
objectA gazetteer interface for querying geographic features.
This class provides access to an installed gazetteer artifact, allowing retrieval of candidate features for name matching using different search strategies: exact, phrase, partial, and fuzzy matching.
- find(identifier: str) Feature | None#
Find a feature by its identifier.
- Parameters:
identifier – The identifier value of the feature to find
- Returns:
Feature object if found, None otherwise
- search(name: str, method: str = 'exact', limit: int = 10000, tiers: int = 1) List[Feature]#
Search for features using the specified search method.
- Parameters:
name – Name string to search for
method – Search method to use (“exact”, “phrase”, “partial”, “fuzzy”)
limit – Maximum number of results to return (default: 10000)
tiers – Number of rank tiers to include in results (default: 1, ignored for exact method)
- Returns:
List of Feature objects matching the search criteria
- Raises:
ValueError – If an unknown search method is specified
Gazetteer builder: compiles a declarative config into a SQLite artifact.
The build pipeline has three stages, each its own progress group:
Preparing sources: resolve (download/extract, cached across builds) and load each source’s file into a transient DuckDB table
Compiling features: compile and run one projection per feature block, producing canonical (identifier, source, data, geometry) and (identifier, name) rows, then merge rows that share an identifier
Building artifact: copy the compiled rows into a temporary SQLite file, build its search structures and metadata, then atomically move it into place
The staging database and all intermediate tables are discarded after the build; the artifact is the only output.