NCZ2Geo
Pure-Python Netcad NCZ/NCA Reader with PlanGML Identity & e-Plan Symbology Metadata
Official PyPI & GitHub Scientific Documentation · Version 0.1.0 · V2-Only Headless Core
Author: Yusuf Eminoğlu · github.com/YusufEminoglu/NCZ2Geo · pypi.org/project/NCZ2Geo
PlanGML Layer Classifier & e-Plan Symbology Simulator
Select a Turkish spatial plan type and type a Netcad layer name to test real-time PlanGML identity resolution and official e-Plan color/hatching extraction:
e-Plan Renk: #ffcc00 · Opacity: 0.70
1. Installation & Quickstart
NCZ2Geo is a focused Python SDK specifically built for Turkish urban planning workflows. It reads Netcad NCZ/NCA drawings, maps CAD layers to official PlanGML / MPYY (Mekânsal Planlar Yapım Yönetmeliği) schemas, and injects official e-Plan symbology metadata into standard GeoJSON features.
Standard Installation
pip install NCZ2Geo
High-Level Python Usage
from ncz2geo import classify_layer, parse_netcad, write_geojson
# 1. Classify any layer name into official PlanGML & e-Plan identity
classification = classify_layer("PL_GELISME_KONUT", plan_type="UIP")
print(f"PlanGML Function: {classification.identity.fonksiyon_adi} (Code: {classification.identity.fonksiyon_kodu})")
print(f"e-Plan Fill Color: {classification.style.fill} | Opacity: {classification.style.fill_opacity}")
# 2. Parse Netcad NCZ and export PlanGML-enriched GeoJSON
result = parse_netcad("imar_plani.ncz")
write_geojson(result.entities, "imar_plani_styled.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
2. PlanGML & Mekânsal Planlar Standardı (MPYY)
In Turkish spatial planning legislation (*Mekânsal Planlar Yapım Yönetmeliği*), every urban planning layer follows standardized hierarchy, function codes, and visual representation rules:
| Plan Type | Administrative Scale | Code Prefix | Primary Scope |
|---|---|---|---|
| UIP | 1/1.000 | 1xxx |
Uygulama İmar Planı: Building blocks, parcel setbacks, detailed land-use |
| NIP | 1/5.000 | 2xxx |
Nazım İmar Planı: Macroform zoning, major arterial transport networks |
| CDP | 1/25.000 · 1/50.000 · 1/100.000 | 3xxx |
Çevre Düzeni Planı: Regional environmental conservation, agricultural zones |
3. Emitted GeoJSON Feature Properties
When exported via write_geojson(), every feature dictionary is enriched with official national spatial planning 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"
}
}
4. NCZ Engine V2 — Modular Architecture
NCZ2Geo uses the V2-only block engine featuring a bounds-checked binary cursor and two-phase catalog parser:
NCZ Archive $\rightarrow$ Zlib Decompression $\rightarrow$ Bounds-Checked Cursor $\rightarrow$ Two-Phase Indexing (O(1)) $\rightarrow$ Selective Geometry Decode $\rightarrow$ PlanGML / e-Plan Matcher $\rightarrow$ GeoJSON Serializer
Fingerprinted Local Index Cache
NCZ2Geo stores drawing metadata and layer catalogs in a fast per-user local JSON cache keyed by file (size, mtime_ns) fingerprints. Reopening an unchanged drawing serves catalog queries in 0.1 ms with zero file read overhead.
5. 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 |
6. Academic Citation & License
Distributed under the GPL-2.0-or-later license.
@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://gitlab.com/geospacephilo/NCZ2Geo}
}