Skip to main content

mojxml-py

Test PyPI Package codecov

法務省登記所備付地図データ(地図XML)を各種GISデータ形式 (GeoJSON, GeoPackage, FlatGeobuf, etc.) に変換するコマンドラインツールです。Pythonライブラリとしても使用できます。

A tool for fast conversion of Japanese "MOJ Map XML" (land registration polygons) into geospatial format, written in Python.

特徴:

  • デジタル庁のリファレンス実装 (mojxml2geojson) よりも高速に変換できます(XMLパーサとして lxml (libxml2) を使用しています)。
  • XMLファイルだけなく、配布されているZIPファイルをそのまま入力することができます。
  • GeoJSON以外の効率的かつコンパクトな形式 (GeoPackage, FlatGeobuf, etc.) でも出力できます。

インストール

Ubuntu/Debian:

apt install libgdal-dev
pip3 install mojxml

macOS (Homebrew):

brew install gdal
pip3 install mojxml

コマンドラインインタフェース

Usage: mojxml2ogr [OPTIONS] DST_FILE SRC_FILES...

  Convert MoJ XMLs to GeoJSON/GeoPackage/FlatGeobuf/etc.

  DST_FILE: output filename (.geojson, .gpkg, .fgb, etc.)

  SRC_FILES: one or more .xml/.zip files

Options:
  --worker [multiprocess|thread|single]
                                  [default: multiprocess]
  -a, --arbitrary                 Include 任意座標系
  -c, --chikugai                  Include 地区外 and 別図
  • 出力フォーマットは、出力ファイル名の拡張子から自動で判断されます。
  • -a オプションを指定すると、任意座標系のXMLファイルも変換されます。
  • -c オプションを指定すると、地番が「地区外」「別図」の地物も出力されます。

使用例

# XMLファイルをGeoJSONに変換する
❯ mojxml2ogr output.geojson 15222-1107-1553.xml

# 複数のXMLファイルを1つのGeoJSONに変換する
❯ mojxml2ogr output.geojson 15222-1107-1553.xml 15222-1107-1554.xml

# 配布用ZIPファイルに含まれる全XMLをFlatGeobufに変換する
❯ mojxml2ogr output.fgb 15222-1107.zip

# 3つのZIPファイルをまとめて1つのFlatGeobufに変換する
❯ mojxml2ogr output.fgb 01202-4400.zip 01236-4400.zip 01337-4400.zip

# ZIPファイルを1段階展開して出てくるZIPファイルも入力できる
❯ mojxml2ogr output.fgb 15222-1107-15*.zip

License

MIT License

テスト用データについて

./testdata/ に含まれるZIPファイルおよびXMLファイルは、「登記所備付地図データ」(法務省)を、登記所備付地図データ利用規約に基づいて複製したものです。

Authors

  • Taku Fukada (@ciscorn) - Original Author
  • MIERUNE Inc.

Metadata

Release files for mojxml 0.5.4

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

Source distribution (sdist)

Source distribution for mojxml 0.5.4
File Size Uploaded Provenance Actions
mojxml-0.5.4.tar.gz 4.4 MB Without provenance Details for mojxml-0.5.4.tar.gz

Built distribution (wheel)

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

Total release size: 4.4 MB

Release files / mojxml-0.5.4.tar.gz

Download URL mojxml-0.5.4.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
1450d7eb5c458fdb310f5d44e48e85c4eba362b75ee4f1944396387f924bf919
BLAKE2b-256 checksum
How to use checksums
341ecf4069071f05d9a55f739ffd6e54d29d7b8671b0cb91e1a1c80a433488a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.8

Release files / mojxml-0.5.4-py3-none-any.whl

Download URL mojxml-0.5.4-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc86709ef12356777e2eeededce587c3b21e2f2ef2f4136b81174547b91541d4
BLAKE2b-256 checksum
How to use checksums
173040e1137a1d377e9dd4d67a7f061e2d3ad742876811a20b9a569bed504342
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.8

Security for mojxml 0.5.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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