Skip to main content

TaiGeotrans

English | 繁體中文

CI PyPI version Python 3.11+ Ruff License: MIT

TaiGeotrans provides Taiwan address geocoding via TGOS and WGS84 ↔ TWD97 coordinate conversion, with a Python API and CLI.

  • Convert between WGS84 (EPSG:4326) and TWD97 (EPSG:3826).
  • Geocode Taiwan addresses through TGOS.
  • Process batches and export pandas DataFrames or GeoJSON.
  • Run conversions from the command line.

Region checks use approximate areas covering Taiwan, Penghu, Kinmen, and Matsu; they do not represent administrative boundaries. Output coordinates always use EPSG:4326 and EPSG:3826. Applying EPSG:3826 to areas such as Kinmen can produce negative X coordinates, which are valid projection results.

Installation

For coordinate conversion:

python -m pip install taigeotrans

Install optional features as needed:

python -m pip install "taigeotrans[geocoding]"
python -m pip install "taigeotrans[dataframe]"
python -m pip install "taigeotrans[cli]"

Or install all runtime features:

python -m pip install "taigeotrans[all]"

Python API

from taigeotrans import TaiGeotrans

tg = TaiGeotrans()

# WGS84 -> TWD97
result = tg.transform_lonlat(121.5654, 25.0330)
print(result.twd97_x, result.twd97_y)

# TWD97 -> WGS84
result = tg.transform_twd97(result.twd97_x, result.twd97_y)
print(result.wgs84_lon, result.wgs84_lat)

Address geocoding

Address geocoding requires the geocoding extra and a TGOS AppID/APIKey pair. Obtain these credentials from TGOS and provide them through environment variables:

export TGOS_APP_ID="your-app-id"
export TGOS_API_KEY="your-api-key"

Alternatively, pass them to TaiGeotrans:

tg = TaiGeotrans(
    tgos_app_id="your-app-id",
    tgos_api_key="your-api-key",
)
result = tg.geocode("臺北市中山區松江路469巷4號")
print(result.matched_address, result.twd97_x, result.twd97_y)

The Python API does not automatically load .env. The CLI loads .env from the current working directory; use .env.example as a template. Keep real credentials out of Git.

Batch processing

addresses = ["嘉義縣民雄鄉中樂路55號", "臺北市信義區市府路1號"]
coords = [(120.4278, 23.5521), (121.5654, 25.0330)]

address_results = tg.batch_geocode(addresses, show_progress=False)
coordinate_results = tg.batch_transform_lonlat(coords, show_progress=False)
df = tg.batch_transform_lonlat_to_dataframe(coords, show_progress=False)

Address batches require TGOS credentials and the geocoding extra. DataFrame methods require taigeotrans[dataframe]. Progress bars use tqdm, available with taigeotrans[progress]; batch methods still work without it, but do not display a progress bar.

GeoJSON

coords = [(120.4278, 23.5521), (121.5654, 25.0330)]
results = tg.batch_transform_lonlat(coords, show_progress=False)
geojson = tg.to_geojson(results)
print(geojson["type"])  # FeatureCollection

GeoJSON uses WGS84 coordinates in [lon, lat] order. By default, failed results are skipped; results without WGS84 coordinates are also skipped.

CLI

python -m pip install "taigeotrans[cli]"

taigeotrans transform 121.5654 25.0330
taigeotrans transform 121.5654 25.0330 --format json
taigeotrans geocode "臺北市信義區市府路1號"
taigeotrans batch-geocode addresses.txt -o results.csv
taigeotrans batch-transform coords.csv -o results.csv

Use one address per line in addresses.txt; coords.csv must contain lon,lat columns. Run taigeotrans --help for all commands. Geocoding commands require TGOS credentials.

Results

Single-address geocoding and coordinate conversion return a GeocodeResult containing input values, WGS84/TWD97 coordinates, source, and status. Status values are success, out_of_bounds, invalid, or failed.

Methods Return type
geocode, transform_lonlat, transform_twd97 GeocodeResult
batch_geocode, batch_transform_lonlat list[GeocodeResult]
batch_geocode_to_dataframe, batch_transform_lonlat_to_dataframe pandas.DataFrame
to_geojson GeoJSON FeatureCollection dictionary

Development

python -m pip install -e ".[dev,all]"
python -m pytest
python -m ruff check src tests
python -m ruff format --check src tests
python -m mypy src
python -m build
python -m twine check dist/*

CI tests Python 3.11–3.13. Pushing a TaiGeotrans-v.X.Y.Z tag triggers the release workflow to build distributions, publish to PyPI, and create a GitHub Release. See CONTRIBUTING.md for release prerequisites.

Documentation

License

MIT License. See LICENSE.

Maintenance

See the maintenance guide (Traditional Chinese) for dependency updates, required CI checks, pinned GitHub Actions, and release verification.

Metadata

Release files for taigeotrans 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taigeotrans 0.1.3
File Size Uploaded Provenance
taigeotrans-0.1.3.tar.gz 22.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for taigeotrans 0.1.3
File Interpreter ABI Platform
taigeotrans-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.3 kB

Release files / taigeotrans-0.1.3.tar.gz

Download URL taigeotrans-0.1.3.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6651e24889aedbfa78367b774c6f4b7d1992e9e87437a14c65a21ca47d9398c7
BLAKE2b-256 checksum
How to use checksums
ad78a73cb126d2416b6d41c204d2cb918dc64e3402e45413940a3dbc1fa45037
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 23, 2026.

Transparency log

Release files / taigeotrans-0.1.3-py3-none-any.whl

Download URL taigeotrans-0.1.3-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ff78d29e33a67c2119a5fd808520ea03289f3c4e67eaa134a91e04e4f2eb5cc
BLAKE2b-256 checksum
How to use checksums
9d148a13d8613bcf5cd7315f9fd455bf7f25322ebd01ebcb2dbb248e9c0bddd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 23, 2026.

Transparency log

Security for taigeotrans 0.1.3

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.

Select from 2 files

Attestation for taigeotrans-0.1.3.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 23, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page