langchain-gridpin — offline geocoding tools for LangChain
LangChain tools that turn addresses into coordinates and coordinates into addresses with GridPin: one memory-mapped file per country ("sheet"), read on your machine. No API key, no rate limit, and no query leaves the machine. The only network step is downloading a sheet once, verified against the signed GridPin release.
Covered countries and sheet sizes: gridpin.dev.
Install
$ pip install langchain-gridpin
$ gridpin-fetch us # once: downloads and verifies the sheet, prints its path
gridpin-fetch comes with the gridpin-mcp dependency. Sheets go to $GRIDPIN_HOME, else
$XDG_CACHE_HOME/gridpin, else ~/.cache/gridpin. From Python:
from langchain_gridpin import download_sheet
download_sheet("us") # no network when the sheet is already there
Use the tools
from langchain_gridpin import GridPinGeocode, GridPinReverse
geocode = GridPinGeocode(country="us")
geocode.invoke({"query": "1600 Pennsylvania Ave NW, Washington, DC 20500"})
# '{"country": "us", "query": "1600 Pennsylvania Ave NW, Washington, DC 20500",
# "results": [{"lat": 38.8976751, "lon": -77.036547, "precision": "house", ...}]}'
reverse = GridPinReverse(country="us")
reverse.invoke({"lat": 38.8977, "lon": -77.0365})
# '{"country": "us", "lat": 38.8977, "lon": -77.0365,
# "results": [{"housenumber": "1600", "street": "PENNSYLVANIA Avenue Northwest", "distance_m": 4.9, ...}]}'
Both tools for one country, for an agent (pip install langchain langchain-anthropic, or any
other chat model with tool calling):
from langchain.agents import create_agent
from langchain_gridpin import GridPinToolkit
agent = create_agent("anthropic:claude-sonnet-5-5", tools=GridPinToolkit(country="us").get_tools())
agent.invoke({"messages": [{"role": "user", "content": "Where is 350 5th Ave, New York?"}]})
| Tool | Arguments | Returns |
|---|---|---|
GridPinGeocode (name gridpin_geocode_<country>) |
query, k (1-10, default 1) |
ranked candidates with lat, lon, precision, confidence, street, housenumber, commune, postcode |
GridPinReverse (name gridpin_reverse_<country>) |
lat, lon, k (1-10, default 1) |
nearest indexed addresses, each with distance_m |
Constructor parameters of both tools and of GridPinToolkit:
country— country code or English name of the sheet, e.g."us". An unknown country fails at construction and the error lists the available ones.sheet— optional path to a sheet file, instead of the downloaded one.
The tools use response_format="content_and_artifact": called by an agent, the ToolMessage
carries the answer as JSON text in content and as a dict in artifact. Called directly with a
dict, as above, they return the JSON text. Tools reading the same sheet share one open file.
A missing sheet or an empty query comes back to the model as an error message it can act on
(for example "run gridpin-fetch us"); set handle_tool_error=False to get an exception
instead. An address that is not found is not an error: results is an empty list.
Results are the same as the GridPin CLI, Python, DuckDB and MCP server return. Treat street
or city precision as approximate.
Links
- GridPin: gridpin.dev, documentation, benchmark
- Source: github.com/gridpin/gridpin (this package lives in
integrations/langchain/) - MCP server for other agent frameworks: gridpin-mcp
If GridPin is useful to you, a star on GitHub helps other people find it.
License: Apache-2.0.
Metadata
Release files for langchain-gridpin 0.1.0
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 |
|---|---|---|---|---|
| langchain_gridpin-0.1.0.tar.gz | 9.7 kB | With provenance | Details for langchain_gridpin-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_gridpin-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_gridpin-0.1.0-py3-none-any.whl |
Total release size: 20.0 kB
Release files / langchain_gridpin-0.1.0.tar.gz
| Download URL | langchain_gridpin-0.1.0.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d112726b31ec20066cf58b9147c5f981e73e9d1a8611ae606b0b297b569f57e4
|
|
BLAKE2b-256 checksum How to use checksums |
a37edea0247a2f38719772100321e0ad6c15e75ae9c6a67b1aebe2fb6f33a7d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / langchain_gridpin-0.1.0-py3-none-any.whl
| Download URL | langchain_gridpin-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8f725b48c63f794ee6980adf0587ed2b73562ecc2272615f1a11883f6dcefeb
|
|
BLAKE2b-256 checksum How to use checksums |
022554869abe8ff96dc77856b499e99b87f374e1118e73e12b7a4ab9025320c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for langchain-gridpin 0.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for langchain_gridpin-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA 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.