Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwg2geo-0.1.0.tar.gz (154.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwg2geo-0.1.0-cp39-abi3-manylinux_2_35_x86_64.whl (937.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.35+ x86-64

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

Hashes for dwg2geo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8aba555a98c22fa0cc76452dce546c039d96ed18c0e67a503a850e382d7ebdd3
MD5 d78d78c949e947279406331a5b6e32c0
BLAKE2b-256 ac41e6f624f34fca271870f8a9edf2ec76e5dda68ec60336a637d76418ef1ff6

See more details on using hashes here.

File details

Details for the file dwg2geo-0.1.0-cp39-abi3-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for dwg2geo-0.1.0-cp39-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 1c3fd9100791cf35a2f07bba0d581e15243986c56ed9b6417aee8badd326ea21
MD5 83b40ef7978e2af56e77aafd2acfb1e7
BLAKE2b-256 b29c6f3a794e114f8456c4983aab367f6e4f11cbc6ef3021f419af26de67b0dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page