pyja-geocoder


Namepyja-geocoder JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA fast vectorized reverse geocoding tool with GeoPandas
upload_time2024-12-21 12:26:49
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords reverse geocoding geopandas japan address
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```bash
pip install pyja-geocoder
```

### Install from Source

1. Clone the repository:
   ```bash
   git clone https://github.com/yourusername/pyja_geocoder.git
   cd pyja_geocoder
   ```

2. Install the package:
   ```bash
   pip install .
   ```

## Usage

### Import the Package

```python
from pyja_geocoder import reverse_geocode_from_df, reverse_geocode_from_points, reverse_geocode_single
```

### Reverse Geocode a Single Point

```python
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

```python
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

```python
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.

```python
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](https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-2024.html).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyja-geocoder",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "reverse geocoding, geopandas, japan, address",
    "author": null,
    "author_email": "Kosaku Nakano <nakanokosaku@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/4c/fa/b7358759e54577821914276726b78e0d0cbc74b10d587a82b52636e67cbf/pyja_geocoder-0.1.3.tar.gz",
    "platform": null,
    "description": "# pyja_geocoder\n\n**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).\n\n## Features\n\n- **Batch Processing**: Reverse geocode multiple coordinates simultaneously using a DataFrame.\n- **Single Point Geocoding**: Reverse geocode a single latitude/longitude coordinate.\n- **Efficient Spatial Operations**: Leverages GeoPandas and spatial indexing for fast lookups.\n\n## Installation\n\n### Install from PyPI\n\n```bash\npip install pyja-geocoder\n```\n\n### Install from Source\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/pyja_geocoder.git\n   cd pyja_geocoder\n   ```\n\n2. Install the package:\n   ```bash\n   pip install .\n   ```\n\n## Usage\n\n### Import the Package\n\n```python\nfrom pyja_geocoder import reverse_geocode_from_df, reverse_geocode_from_points, reverse_geocode_single\n```\n\n### Reverse Geocode a Single Point\n\n```python\nlat, lon = 35.6895, 139.6917  # Latitude and longitude for Tokyo\ncity, citycode = reverse_geocode_single(lat, lon)\nprint(\"City:\", city)\nprint(\"City Code:\", citycode)\n```\n\n### Reverse Geocode a List of Points\n\n```python\npoints = [(35.6895, 139.6917), (34.6937, 135.5022)]  # Tokyo and Osaka\nresult_df = reverse_geocode_from_points(points)\nprint(result_df)\n```\n\n### Reverse Geocode a DataFrame of Points\n\n```python\nimport pandas as pd\n\ndf = pd.DataFrame({\"latitude\": [35.6895, 34.6937], \"longitude\": [139.6917, 135.5022]})\nresult_df = reverse_geocode_from_df(df)\nprint(result_df)\n```\n\n### Load the Default Shapefile\n\nThe package uses the official MLIT shapefile for geocoding. The data will be downloaded and cached automatically if not already present.\n\n```python\nfrom pyja_geocoder import load_japan_shapefile\n\ngdf = load_japan_shapefile()  # Load the MLIT shapefile as a GeoDataFrame\n```\n\n\n## Data Source\n\nThe shapefile used by this package is sourced from MLIT (Ministry of Land, Infrastructure, Transport, and Tourism). The latest data can be accessed [here](https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-2024.html).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A fast vectorized reverse geocoding tool with GeoPandas",
    "version": "0.1.3",
    "project_urls": {
        "Documentation": "https://github.com/nkosaku/pyja_geocoder#readme",
        "Source Code": "https://github.com/nkosaku/pyja_geocoder"
    },
    "split_keywords": [
        "reverse geocoding",
        " geopandas",
        " japan",
        " address"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3671e86b63ca3add192f8eaafbd6083cbadfe7af628600320b5b2c83d44c1dd",
                "md5": "0de5038e2d36f5acb710472c1b242ba5",
                "sha256": "aa15a1ec8c6666686f9df3073d78536da776f812837a841f4e6699aaee27eaba"
            },
            "downloads": -1,
            "filename": "pyja_geocoder-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0de5038e2d36f5acb710472c1b242ba5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6584,
            "upload_time": "2024-12-21T12:26:47",
            "upload_time_iso_8601": "2024-12-21T12:26:47.470951Z",
            "url": "https://files.pythonhosted.org/packages/c3/67/1e86b63ca3add192f8eaafbd6083cbadfe7af628600320b5b2c83d44c1dd/pyja_geocoder-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4cfab7358759e54577821914276726b78e0d0cbc74b10d587a82b52636e67cbf",
                "md5": "26a34c05f5059b1551bdb3eb3ff874ff",
                "sha256": "3ed8ed99343200d8aec076b0060d1bfa5296c198836a417a8228c54d1741f754"
            },
            "downloads": -1,
            "filename": "pyja_geocoder-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "26a34c05f5059b1551bdb3eb3ff874ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6426,
            "upload_time": "2024-12-21T12:26:49",
            "upload_time_iso_8601": "2024-12-21T12:26:49.845747Z",
            "url": "https://files.pythonhosted.org/packages/4c/fa/b7358759e54577821914276726b78e0d0cbc74b10d587a82b52636e67cbf/pyja_geocoder-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-21 12:26:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nkosaku",
    "github_project": "pyja_geocoder#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyja-geocoder"
}
        
Elapsed time: 0.43251s