Convert — Autocad Coordinates To Google Earth __hot__
AutoCAD, Google Earth, coordinate transformation, WGS84, KML, geodesy, Helmert transformation. 1. Introduction 1.1 Problem Statement AutoCAD drawings are often created in local coordinate systems (e.g., assumed origin at building corner) to simplify drafting. However, for real-world visualization, environmental analysis, or infrastructure planning, these drawings must be placed accurately on Google Earth’s globe. Manual shifting is imprecise and time-consuming. 1.2 Objective To develop a repeatable, mathematically sound transformation pipeline that converts any AutoCAD coordinate set into a Google Earth KML file with minimal loss of accuracy. 1.3 Scope The paper focuses on 2D horizontal transformation plus vertical conversion from assumed sea level to WGS84 ellipsoidal height. 2. Coordinate Systems Involved | System | Units | Origin | Use | |--------|-------|--------|-----| | AutoCAD World UCS | Meters or feet | Arbitrary (e.g., 0,0 at building SW corner) | Local drafting | | Geographic (WGS84) | Degrees (lat/lon) | Earth’s center of mass | Google Earth | | Projected (UTM) | Meters | Zone central meridian | Intermediate step for scaling |
from pyproj import Transformer transformer = Transformer.from_crs("EPSG:4326", "EPSG:32618") # WGS84 to UTM 18N easting, northing = transformer.transform(lat, lon) Find parameters: translation (Tx, Ty), rotation (θ), scale (s). System: E = s*(X*cosθ – Y*sinθ) + Tx N = s*(X*sinθ + Y*cosθ) + Ty convert autocad coordinates to google earth
# Step 2: Helmert (simplified – affine) A = [] B = [] for (x, y), (e, n) in zip(source_ac, target_utm): A.append([x, y, 1, 0]) A.append([y, -x, 0, 1]) B.append(e) B.append(n) params, _, _, _ = np.linalg.lstsq(A, B, rcond=None) a, b, tx, ty = params n) in zip(source_ac
The final KML overlaid on Google Earth showed alignment within 0.5 m of satellite imagery, sufficient for conceptual design and site analysis. import numpy as np from pyproj import Transformer import simplekml def autocad_to_google_earth(auto_points, control_pairs, utm_zone): # auto_points: list of (x, y) in AutoCAD # control_pairs: [ (ac_x, ac_y, lat, lon) ] # Step 1: project lat/lon to UTM transformer = Transformer.from_crs("EPSG:4326", f"EPSG:utm_zone") target_utm = [transformer.transform(lat, lon) for (_, _, lat, lon) in control_pairs] source_ac = [(x, y) for (x, y, _, _) in control_pairs] 1]) B.append(e) B.append(n) params
