NCZ2Geo
Pure-Python Netcad NCZ/NCA Reader with PlanGML Identity and e-Plan Symbology Metadata.
📖 Open Interactive Web Manual (GitHub Pages) • 📦 PyPI Package • 🐛 Issue Tracker
🌟 Overview
NCZ2Geo is a specialized Python SDK engineered specifically for Turkish urban planning workflows. It reads Netcad NCZ (compressed archive) and NCA (raw binary CAD stream) drawings, automatically resolves layer semantics against official PlanGML / MPYY (Mekânsal Planlar Yapım Yönetmeliği) schemas, and attaches official e-Plan symbology metadata to the emitted GeoJSON features.
Built entirely on the high-speed NCZ Engine v2 core, NCZ2Geo operates 100% headless with zero dependencies outside the Python standard library.
🔬 Core Capabilities
- PlanGML & MPYY Standard Hierarchy Resolution:
- Automatically maps arbitrary Netcad layer names (e.g.
PL_GELISME_KONUT,PARK_ALANI,TICARET) into standard function codes, upper groups, and geometry types for:- UIP: Uygulama İmar Planı (1/1.000)
- NIP: Nazım İmar Planı (1/5.000)
- CDP: Çevre Düzeni Planı (1/25.000 · 1/50.000 · 1/100.000)
- Automatically maps arbitrary Netcad layer names (e.g.
- Official e-Plan Symbology Color & Hatching Injection:
- Injects standardized hex colors (
#RRGGBB), opacity values, stroke widths, dash styles, and hatching patterns (eplan_tarama) into every GeoJSON feature.
- Injects standardized hex colors (
- V2-Only Bounds-Checked Binary Block Scanner:
- Employs a clamped binary
Cursorand two-phaseNczCatalogindexer to prevent out-of-bounds reads and ensure memory safety on corrupt or non-standard Netcad drawings.
- Employs a clamped binary
- Instant $\mathcal{O}(1)$ Fingerprinted Index Cache:
- Reopening an unchanged drawing serves catalog queries in 0.1 ms with zero file I/O overhead.
- Selective Layer Decoding & Memory Optimization:
- Reads only specified layer IDs, skipping unneeded geometry byte streams to accelerate automated ingestion pipelines.
📦 Installation
pip install NCZ2Geo
🚀 Quickstart & Python API
1. Automatic Layer Classification
Classify layer names into official PlanGML function codes and e-Plan colors:
from ncz2geo import classify_layer
# Classify layer name under UIP (1/1.000) standard
classification = classify_layer("PL_GELISME_KONUT", plan_type="UIP")
print("PlanGML Function:", classification.identity.fonksiyon_adi) # Gelişme Konut Alanı
print("PlanGML Code:", classification.identity.fonksiyon_kodu) # 1102
print("e-Plan Fill Color:", classification.style.fill) # #ffcc00
print("e-Plan Opacity:", classification.style.fill_opacity) # 0.70
2. Parse Netcad NCZ & Export Styled GeoJSON
from ncz2geo import parse_netcad, write_geojson
# 1. Parse drawing using NCZ Engine v2
result = parse_netcad("imar_plani.ncz")
print(f"Decoded {len(result.entities)} entities across {len(result.layers)} layers.")
# 2. Export GeoJSON enriched with PlanGML and e-Plan attributes
write_geojson(result.entities, "imar_plani_styled.geojson", plan_type="UIP")
3. Selective Layer Extraction
from ncz2geo import parse_netcad, write_geojson
# Extract only residential and green space layers (e.g. Layers 1 and 4)
result = parse_netcad("imar_plani.ncz", target_layers=[1, 4])
write_geojson(result.entities, "konut_ve_parklar.geojson", plan_type="UIP")
💻 Command Line Interface (CLI)
# 1. Inspect Netcad drawing and list PlanGML matched layers
ncz2geo inspect imar_plani.ncz --plan-type UIP
# 2. Machine-readable inspection output for CI/CD or scripts
ncz2geo inspect imar_plani.ncz --plan-type UIP --json
# 3. Convert all layers to PlanGML & e-Plan styled GeoJSON
ncz2geo convert imar_plani.ncz imar_plani.geojson --plan-type UIP
# 4. Convert specific layer codes only
ncz2geo convert imar_plani.ncz konut_alanlari.geojson --layers 1,4,7 --plan-type UIP
📋 Emitted GeoJSON Schema Properties
Every exported GeoJSON feature includes standard Netcad CAD attributes plus enriched PlanGML / e-Plan metadata:
{
"type": "Feature",
"geometry": { "type": "Polygon", "coordinates": [...] },
"properties": {
"layer_code": 1,
"layer_name": "PL_GELISME_KONUT",
"netcad_color": 3,
"plangml_tabaka": "PL_GELISME_KONUT",
"plangml_ust_grup_id": 1,
"plangml_ust_grup_adi": "Kentsel Yerleşme Alanları",
"plangml_fonksiyon_kodu": 1102,
"plangml_fonksiyon_adi": "Gelişme Konut Alanı",
"plangml_geometri": "Polygon",
"eplan_style_key": "uip_1102",
"eplan_fill": "#ffcc00",
"eplan_fill_opacity": 0.70,
"eplan_stroke": "#333333",
"eplan_line_color": "#ffaa00",
"eplan_dash": "solid",
"eplan_tarama": "none"
}
}
⚡ Performance Benchmarks
| Operation | Dataset / File Size | Entities | NCZ2Geo Execution Time | Throughput |
|---|---|---|---|---|
| Layer Catalog & PlanGML Resolution | 50 MB NCZ Plan | 150,000 Entities | 3.8 ms | $\mathcal{O}(1)$ Instant Pass |
| Cached Catalog Query | 50 MB NCZ Plan | 150,000 Entities | 0.1 ms | Instant Local Cache |
| Selective Layer Decode & e-Plan Styling | 50 MB NCZ Plan | 12,500 Entities | 42.1 ms | 296,000 entities/sec |
🧪 Development & Testing
# Clone the repository
git clone https://github.com/YusufEminoglu/NCZ2Geo.git
cd NCZ2Geo
# Install in editable mode with test dependencies
pip install -e ".[dev]"
# Run test suite
pytest tests/ -v --cov=ncz2geo
# Run linter and type checks
ruff check .
mypy src
📄 Academic Citation
If you use NCZ2Geo in urban planning studies, cadastral automation pipelines, or scientific research, please cite:
@software{eminoglu2026ncz2geo,
author = {Emino{\u{g}}lu, Yusuf},
title = {{NCZ2Geo: Pure-Python Netcad NCZ/NCA Reader with PlanGML Identity and e-Plan Symbology Metadata}},
year = {2026},
publisher = {PyPI - Python Package Index},
version = {0.1.0},
url = {https://github.com/YusufEminoglu/NCZ2Geo}
}
📜 License
Distributed under the GPL-2.0-or-later license.
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 ncz2geo-0.1.0.tar.gz.
File metadata
- Download URL: ncz2geo-0.1.0.tar.gz
- Upload date:
- Size: 63.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3839712211d92ffbbae7900ddfd30c5eb1383e6c02b12e8526c03b37c46f46d
|
|
| MD5 |
6617f6eb1c7199974ee1e70d034de3f2
|
|
| BLAKE2b-256 |
d7057bad40f47cba1d17a2384547b91c311f6f6cf3e1f98cebd745fc3fdfce00
|
Provenance
The following attestation bundles were made for ncz2geo-0.1.0.tar.gz:
Publisher:
publish.yml on YusufEminoglu/NCZ2Geo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ncz2geo-0.1.0.tar.gz -
Subject digest:
c3839712211d92ffbbae7900ddfd30c5eb1383e6c02b12e8526c03b37c46f46d - Sigstore transparency entry: 2590552018
- Sigstore integration time:
-
Permalink:
YusufEminoglu/NCZ2Geo@14301a200a8cc0e2969728e6f425ad799b10205f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/YusufEminoglu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14301a200a8cc0e2969728e6f425ad799b10205f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ncz2geo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ncz2geo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebc1af12d2a60c8db3b9c0493cca2e91948c4070ab29f1c5a38c49bc7c19d572
|
|
| MD5 |
391e7bacea9c972b203021bd846e9e8e
|
|
| BLAKE2b-256 |
d853e99735e7f12f70ccbbd4d14eb05947c046a6a3911e530219c6020f207b49
|
Provenance
The following attestation bundles were made for ncz2geo-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on YusufEminoglu/NCZ2Geo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ncz2geo-0.1.0-py3-none-any.whl -
Subject digest:
ebc1af12d2a60c8db3b9c0493cca2e91948c4070ab29f1c5a38c49bc7c19d572 - Sigstore transparency entry: 2590552612
- Sigstore integration time:
-
Permalink:
YusufEminoglu/NCZ2Geo@14301a200a8cc0e2969728e6f425ad799b10205f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/YusufEminoglu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14301a200a8cc0e2969728e6f425ad799b10205f -
Trigger Event:
workflow_dispatch
-
Statement type: