Convert engineering DWG drawings to auditable GeoJSON (pure-Rust, no CAD software needed)
Project description
dwg2geo (Python)
Convert engineering DWG drawings to GeoJSON from Python — the pure-Rust dwg2geo converter as a native extension. No AutoCAD, no LibreDWG, no GDAL needed.
pip install dwg2geo
import json
import dwg2geo
result = dwg2geo.convert_file("drawing.dwg") # or dwg2geo.convert(raw_bytes)
fc = json.loads(result["geojson"]) # GeoJSON FeatureCollection (local drawing coords)
print(result["feature_count"], "features")
print(result["converted"]) # per-entity-type counts
print(result["skipped"], result["failed"]) # with reasons — auditable
Options: convert(data, polygonize_closed=False, curve_tolerance=None).
The result dict mirrors dwg2geo's EmbedResult:
| key | meaning |
|---|---|
geojson |
FeatureCollection string in the drawing's local coordinates |
feature_count, model_space_entities |
totals |
converted / skipped / failed |
per-entity-type outcomes with reasons |
warnings |
conversion warnings |
bbox |
[minx, miny, maxx, maxy] or None |
source_sha256 |
hash of the input bytes (audit trail) |
Features carry resolved CAD style metadata (layer, color_rgb, color_index, linetype, lineweight_mm, text properties…). Coordinates are local — georeference with e.g. pyproj using the drawing's known CRS; dwg2geo never guesses one:
from pyproj import Transformer
transformer = Transformer.from_crs("EPSG:31983", "EPSG:4326", always_xy=True)
lon, lat = transformer.transform(x, y)
Deterministic: the same bytes always produce byte-identical GeoJSON.
License: MIT.
Project details
Release history Release notifications | RSS feed
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 dwg2geo-0.1.0.tar.gz.
File metadata
- Download URL: dwg2geo-0.1.0.tar.gz
- Upload date:
- Size: 154.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aba555a98c22fa0cc76452dce546c039d96ed18c0e67a503a850e382d7ebdd3
|
|
| MD5 |
d78d78c949e947279406331a5b6e32c0
|
|
| BLAKE2b-256 |
ac41e6f624f34fca271870f8a9edf2ec76e5dda68ec60336a637d76418ef1ff6
|
File details
Details for the file dwg2geo-0.1.0-cp39-abi3-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: dwg2geo-0.1.0-cp39-abi3-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 937.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3fd9100791cf35a2f07bba0d581e15243986c56ed9b6417aee8badd326ea21
|
|
| MD5 |
83b40ef7978e2af56e77aafd2acfb1e7
|
|
| BLAKE2b-256 |
b29c6f3a794e114f8456c4983aab367f6e4f11cbc6ef3021f419af26de67b0dc
|