A fast vectorized reverse geocoding tool with GeoPandas
Project description
pyja_geocoder
pyja_geocoder is a Python package for reverse geocoding in Japan. It uses vectorized operations with GeoPandas to efficiently map latitude and longitude coordinates to corresponding Japanese city attributes, based on official shapefile data provided by MLIT (Ministry of Land, Infrastructure, Transport, and Tourism).
Features
- Batch Processing: Reverse geocode multiple coordinates simultaneously using a DataFrame.
- Single Point Geocoding: Reverse geocode a single latitude/longitude coordinate.
- Efficient Spatial Operations: Leverages GeoPandas and spatial indexing for fast lookups.
Installation
Install from PyPI
pip install pyja-geocoder
Install from Source
-
Clone the repository:
git clone https://github.com/yourusername/pyja_geocoder.git cd pyja_geocoder
-
Install the package:
pip install .
Usage
Import the Package
from pyja_geocoder import reverse_geocode_from_df, reverse_geocode_from_points, reverse_geocode_single
Reverse Geocode a Single Point
lat, lon = 35.6895, 139.6917 # Latitude and longitude for Tokyo
city, citycode = reverse_geocode_single(lat, lon)
print("City:", city)
print("City Code:", citycode)
Reverse Geocode a List of Points
points = [(35.6895, 139.6917), (34.6937, 135.5022)] # Tokyo and Osaka
result_df = reverse_geocode_from_points(points)
print(result_df)
Reverse Geocode a DataFrame of Points
import pandas as pd
df = pd.DataFrame({"latitude": [35.6895, 34.6937], "longitude": [139.6917, 135.5022]})
result_df = reverse_geocode_from_df(df)
print(result_df)
Load the Default Shapefile
The package uses the official MLIT shapefile for geocoding. The data will be downloaded and cached automatically if not already present.
from pyja_geocoder import load_japan_shapefile
gdf = load_japan_shapefile() # Load the MLIT shapefile as a GeoDataFrame
Data Source
The shapefile used by this package is sourced from MLIT (Ministry of Land, Infrastructure, Transport, and Tourism). The latest data can be accessed here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyja_geocoder-0.1.0.tar.gz.
File metadata
- Download URL: pyja_geocoder-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
987770b09487d90189cde1bb91335a43557972e1d3728123c0a386bb05add485
|
|
| MD5 |
a9a76dbfbf27f2fe16a85fd4e4affd4b
|
|
| BLAKE2b-256 |
da0f902e6b94bc50d786149ef19c67f527be1c083f4027939eadedc4dd271260
|
Provenance
The following attestation bundles were made for pyja_geocoder-0.1.0.tar.gz:
Publisher:
python-publish.yml on nkosaku/pyja_geocoder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyja_geocoder-0.1.0.tar.gz -
Subject digest:
987770b09487d90189cde1bb91335a43557972e1d3728123c0a386bb05add485 - Sigstore transparency entry: 156922451
- Sigstore integration time:
-
Permalink:
nkosaku/pyja_geocoder@82cd57fc31506350d648fdda92bb9f4366fd4a2c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nkosaku
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@82cd57fc31506350d648fdda92bb9f4366fd4a2c -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyja_geocoder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyja_geocoder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb281905107dd42440920c5be77f5b06829089a27044c978a7324fa8afebf07
|
|
| MD5 |
c302a14153b98d732bbcfcea5e09149a
|
|
| BLAKE2b-256 |
543ab70dab951fffb73dec47a3ed19b2b4534b2c864966a5113a4ecd22541562
|
Provenance
The following attestation bundles were made for pyja_geocoder-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on nkosaku/pyja_geocoder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyja_geocoder-0.1.0-py3-none-any.whl -
Subject digest:
bfb281905107dd42440920c5be77f5b06829089a27044c978a7324fa8afebf07 - Sigstore transparency entry: 156922455
- Sigstore integration time:
-
Permalink:
nkosaku/pyja_geocoder@82cd57fc31506350d648fdda92bb9f4366fd4a2c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nkosaku
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@82cd57fc31506350d648fdda92bb9f4366fd4a2c -
Trigger Event:
release
-
Statement type: