Skip to main content

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

  1. Clone the repository:

    git clone https://github.com/yourusername/pyja_geocoder.git
    cd pyja_geocoder
    
  2. 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

pyja_geocoder-0.1.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyja_geocoder-0.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pyja_geocoder-0.1.1.tar.gz.

File metadata

  • Download URL: pyja_geocoder-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyja_geocoder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bdcb97875e37722e1b513a70db021338e6a57eb018ab56e48a6202eb2aa4e95f
MD5 da89687bc7697244d74af45bd42c7fa5
BLAKE2b-256 55ed29a3e28746027d03f1b5e88459da382ac4c8083ccb1782a9d6ad673e7a9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyja_geocoder-0.1.1.tar.gz:

Publisher: python-publish.yml on nkosaku/pyja_geocoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyja_geocoder-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyja_geocoder-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyja_geocoder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1b8c0180de971378c268e9f63e1945d72cb4a21af4c73728526d264941c67c5
MD5 3dcb99054ee79c5c0e4eaa37180bc549
BLAKE2b-256 9811f3d1274c5de736f4d017cdcb77d426a9305e3877a19446d4292a9011c373

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyja_geocoder-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on nkosaku/pyja_geocoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page