DWG Not Aligning with GIS Data

DWG Not Aligning with GIS Data

It is the most common phone call a CAD manager takes, and it always starts the same way. “I’ve put the drawing on the map and it’s in the wrong place.” Sometimes the voice on the line is a junior technician, sometimes it’s a project manager with a client meeting in an hour, and once it was a very senior engineer who had been staring at the problem since breakfast and had, in the meantime, moved the drawing by hand three times, each time getting it to fit one corner and making it worse somewhere else.

I have fielded that call hundreds of times, and over the years I found that I asked the same four questions, in the same order, before I touched anything. Is the misfit the same everywhere? Which direction? How big? Does it change with distance? The answers took two minutes, and in about nine cases out of ten they told me the cause before I had even opened the file. A constant shift is a datum, an origin or a false easting. A scale is a unit or a grid-ground factor. A rotation is a north reference. A mirror is swapped axes. A mess, where nothing follows a pattern, is a distorted source, a digitized paper plan or a drawing that simply isn’t what you thought it was.

This guide teaches you to ask those questions with numbers, so that you stop nudging drawings by hand and start diagnosing them. I’ll give you a symptom table, a decision process, a small, tested toolkit that fits a transformation from control points and tells you what kind of error you have, the specific causes in CAD and in GIS, the fixes (and the fixes you must never use), and a prevention checklist. It is part of our Autodesk series. For the concepts behind it, see Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained and Layer Not Aligning? Solving CRS Mismatch Problems. For the next problem on the list, a drawing that has no coordinate system at all, see Missing or Wrong Coordinate System in AutoCAD Drawings.

A note on facts: command names and dialogs vary by version, and I cannot run Autodesk or Esri software here. The Python diagnostic code in this guide was tested on synthetic data with known errors. The software-specific steps are patterns to verify in your version.

Diagram: The size and nature of the offset point to the cause: missing CRS, wrong CRS, scale or a local origin.
The size and nature of the offset point to the cause: missing CRS, wrong CRS, scale or a local origin.

First, Stop Moving the Drawing

Before anything else, the rule that saves the most time: don’t fix a misalignment by moving things until you know why they are misaligned. A hand-nudged drawing hides the cause, destroys the evidence and fits at one place only. Instead:

  1. Leave the data as it is.
  2. Pick control points: features that you can identify in both the drawing and the GIS, well spread across the area (corners and the middle, not all in one place). Survey monuments, building corners, manholes, road intersections and kerb corners are good. Use at least three, and preferably five or more.
  3. Record their coordinates in both datasets.
  4. Analyze the differences (the next section).

Five points, a pencil and two minutes of arithmetic will beat an hour of dragging.


The Symptom Table

What you seeMost likely causeHow to testTypical fix
Same shift everywhere (a constant dx, dy)A datum difference, a missing false easting/northing, a drawing origin that was moved, or a wrong zoneCompute the mean offset. Is it small and consistent (a datum shift), or round (an origin, a false easting)?Assign the correct coordinate system and transform, or apply the documented shift
Misfit grows with distance from one pointA scale error: units (feet, millimeters), or a grid-ground factorFit a scale factor. Does it equal 0.3048, 1000, 0.001, or 1.0002-ish?Correct units and coordinate system. Convert grid to ground (or the reverse) deliberately
A constant angle between linesA rotation: north reference (true, grid, magnetic, assumed), a rotated UCS, or a local gridFit a rotation. Compare with known grid convergenceReorient, with the surveyor’s north definition
Mirror image, or east-west swapped with north-southSwapped axes (northing/easting reversed) or a flipped axisThe fit has a negative determinantSwap or flip the axes, then check
Huge offset (kilometers to thousands of kilometers, or “in the ocean”)No coordinate system, local coordinates read as real ones, or a false easting of 500,000 or 1,000,000Look at the magnitude of the drawing’s coordinatesEstablish the real system. See Missing or Wrong Coordinate System in AutoCAD Drawings
Close at one end, far at the otherScale and rotation together, or a distorted sourceCompare residuals along the drawingFit a similarity transformation, and review the source
Fits in places, not others, with no patternA digitized or scanned source with local distortion, or a mixture of datasetsResiduals are not systematicRubber-sheeting, or re-surveying. Accept limited accuracy
Horizontal fits, heights don’tA vertical datum or unit differenceCompare elevations at control pointsApply the vertical offset or geoid model, and fix units
Jitter or “wobble” far from the originPrecision limits at large coordinates in the viewerDoes it move when you pan or zoom?Work with a local offset, then transform
Everything fits except text or symbolsText insertion points, block base points or symbol offsetsCheck the objects’ own insertion pointsTreat as annotation, not geometry

The Four Questions, with Numbers

1. Is the misfit the same everywhere?

Measure at three or more well-separated control points. If the displacement vectors are identical, you have a pure shift. If they grow with distance, or rotate, you have scale or rotation.

2. In which direction?

A shift to the east and north? Toward the origin? Along one axis only? The pattern points to causes: a shift toward the origin often means a false easting was dropped. A shift along one axis only may mean a northing or easting offset.

3. How big?

Magnitude is a clue by itself:

SizeLikely cause
Centimeters to a decimeterHalf a pixel (rasters), grid-ground over a small area, a datum realization difference
A meter or twoDatum or realization difference, a wrong transformation, digitizing accuracy
Tens to hundreds of metersA different datum (an old national datum against a modern one), a missing local grid shift
KilometersA wrong zone, a missing false easting or a wrong projection
Hundreds of kilometers or moreNo coordinate system, a local coordinate system read as real, or swapped axes

4. Does it change with distance?

Constant means shift. Proportional means scale. Rotational (perpendicular to the direction from a fixed point) means rotation. A mixture of these means a similarity transformation (shift, scale and rotation together), which is exactly what a wrong zone or a local grid produces.


A Diagnostic Toolkit: Fit the Transformation and Read It

Instead of reading vectors by eye, fit a transformation from the control point pairs and let the numbers speak. A similarity transformation has four parameters: a scale, a rotation and a shift in each direction. If the residuals after fitting are small, the misfit is systematic, and the fitted numbers tell you the cause. If they stay large, the source is distorted.

import math
import numpy as np

def fit_similarity(src, dst):
    """Fit scale, rotation (degrees), translation and residuals mapping src points to dst points."""
    src, dst = np.asarray(src, float), np.asarray(dst, float)
    cs, cd = src.mean(0), dst.mean(0)
    s0, d0 = src - cs, dst - cd
    a = (s0 * d0).sum() / (s0 ** 2).sum()                                   # scale * cos(rotation)
    b = (s0[:, 0] * d0[:, 1] - s0[:, 1] * d0[:, 0]).sum() / (s0 ** 2).sum() # scale * sin(rotation)
    scale, rotation = math.hypot(a, b), math.degrees(math.atan2(b, a))
    R = np.array([[a, -b], [b, a]])
    t = cd - R @ cs
    residuals = np.hypot(*(((R @ src.T).T + t) - dst).T)
    return scale, rotation, t, residuals

def fit_affine(src, dst):
    """General affine fit. A negative determinant of the linear part means a mirror image (swapped axes)."""
    src, dst = np.asarray(src, float), np.asarray(dst, float)
    A = np.hstack([src, np.ones((len(src), 1))])
    M, *_ = np.linalg.lstsq(A, dst, rcond=None)
    return M[:2].T, M[2]

KNOWN_UNIT_RATIOS = {"mm->m": 0.001, "m->mm": 1000.0, "ft->m": 0.3048, "m->ft": 3.280839895,
                     "usft->m": 1200 / 3937, "cm->m": 0.01, "inch->m": 0.0254}

def diagnose(scale, rotation_deg, shift, det=1.0):
    notes = []
    if det < 0:
        notes.append("MIRRORED OR AXES SWAPPED: easting and northing exchanged, or one axis flipped")
    unit_hit = False
    for name, ratio in KNOWN_UNIT_RATIOS.items():
        if abs(scale / ratio - 1) < 0.01:
            notes.append(f"scale matches a unit change ({name})")
            unit_hit = True
    if not unit_hit and abs(scale - 1) > 1e-5 and 0.999 < scale < 1.001:
        notes.append(f"scale {scale:.6f}: grid-ground or projection scale factor (about {(scale - 1) * 1e6:.0f} ppm)")
    if 0.01 < abs(rotation_deg) < 30:
        notes.append(f"rotation {rotation_deg:.3f} deg: north reference or grid convergence")
    elif abs(rotation_deg) >= 30:
        notes.append(f"large rotation {rotation_deg:.1f} deg: local grid or wrong north")
    if math.hypot(*shift) > 0.5 and abs(scale - 1) < 1e-5 and abs(rotation_deg) < 0.01:
        notes.append(f"pure shift of {math.hypot(*shift):.2f}: datum shift, origin or false easting/northing")
    return notes or ["no systematic transformation found: look at individual points"]

Four tests with known errors

On a synthetic set of five control points (a 100 by 80 rectangle plus its centre), each case was built with a known error, and the diagnosis recovered it:

pts = np.array([[0, 0], [100, 0], [100, 80], [0, 80], [50, 40]], float)

# a) A pure shift of (12.5, -7.3)
print(diagnose(*fit_similarity(pts, pts + [12.5, -7.3])[:3]))
# ['pure shift of 14.48: datum shift, origin or false easting/northing']

# b) The drawing is in feet, the GIS in meters
print(diagnose(*fit_similarity(pts, pts * 0.3048 + [450000, 5410000])[:3]))
# ['scale matches a unit change (ft->m)', 'scale matches a unit change (usft->m)']

# c) A grid-ground scale of 1.0003 and a 12 degree rotation
th = math.radians(12)
R = np.array([[math.cos(th), -math.sin(th)], [math.sin(th), math.cos(th)]]) * 1.0003
print(diagnose(*fit_similarity(pts, (R @ pts.T).T + [1000, 2000])[:3]))
# ['scale 1.000300: grid-ground or projection scale factor (about 300 ppm)', 'rotation 12.000 deg: north reference or grid convergence']

# d) Northing and easting swapped
swapped = pts[:, ::-1]
M, _ = fit_affine(pts, swapped)
s, r, t, _ = fit_similarity(pts, swapped)
print(diagnose(s, r, t, det=np.linalg.det(M)))
# ['MIRRORED OR AXES SWAPPED: ...', 'large rotation 90.0 deg: ...']

Three lessons from the tests. First, case (b) reports two unit matches: the international foot and the US survey foot differ by only 2 parts per million, which a fit cannot tell apart. You need the surveyor to say which one was used. Second, the difference matters at large coordinates: at a coordinate of 2,000,000 feet, the two feet differ by about 1.2 meters (2.0 ppm of 609,600 meters), which is exactly the kind of mysterious “a meter or so” misfit that has defeated people for decades. Third, always look at the residuals the fit returns. If they are small (a centimeter or two for good control), the diagnosis is trustworthy. If they stay large, the source is distorted and no simple fix exists. For example, one point displaced by 10 centimeters in a five-point set shows up as a residual of 5.5 centimeters at that point, and smaller residuals at the others, which tells you one control point is wrong, not the whole drawing.

Use the diagnosis as a hypothesis. Then verify it by applying the fix to the control points and checking that the residuals fall to a plausible size.


The Causes, One by One

1. Datum difference

Two datasets in the same projection family but on different datums (for example, an old national datum and a modern satellite-based one) differ by a roughly constant offset of meters to hundreds of meters, varying slowly across the region. The fix is a proper datum transformation, using the official parameters or grids, not an eyeballed shift. See Coordinate Reference Systems (CRS) Explained Simply. Beware that several transformations may exist for the same pair of datums, with different accuracy, and that GIS software may pick a default that isn’t right for your region.

2. Missing false easting or wrong zone

Projected systems add a false easting (commonly 500,000 meters for UTM-type systems) so that coordinates are positive. If one dataset includes it and the other doesn’t, they differ by exactly that amount (a round number, which is the signature). If the zone is wrong, the offset is a large, roughly regular distance, and the rotation will differ.

3. Units

Feet and meters. Millimeters and meters. Also US survey feet against international feet, the two-parts-per-million trap above. Check the drawing’s units (the INSUNITS variable) and, in Map 3D and Civil 3D, the coordinate system’s units. A drawing in millimeters assigned a coordinate system in meters has a scale of exactly 1000. A drawing whose units are “unitless” is a warning sign. See Missing or Wrong Coordinate System in AutoCAD Drawings.

4. Grid versus ground

A ground-scaled coordinate system differs from the grid by a scale factor (commonly a few hundred parts per million). Over a 5-kilometer project, 300 ppm is 1.5 meters at the far end. For example, a grid distance of 1,000.000 meters with a combined factor of 0.9998 is about 1,000.279 meters on the ground. The signature is a scale very close to 1, which grows with distance from the point at which the grid and ground coincide. See Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained.

5. North reference and rotation

A drawing aligned to a building, a road or magnetic north will be rotated against a grid. Even between two correct grids, the angle between true north and grid north (grid convergence) is typically fractions of a degree to a couple of degrees, enough to move a point 100 meters from the origin by 0.2 to 3.5 meters. Another source of rotation is a rotated UCS or a rotated viewport that someone forgot about.

6. Swapped axes

Northing and easting exchanged. Some systems and file formats put Y before X. It’s common when coordinates are typed or imported from tables. The fit shows a negative determinant, and a large rotation near 90 degrees.

7. Insertion, scale and rotation of blocks and xrefs

A drawing placed as a block or external reference may be inserted with a scale, a rotation or an offset, so that the content is not in the coordinates you think. Check the insertion point, scale factors and rotation in the properties. A drawing that looks fine on its own and wrong when referenced is nearly always this. See Civil 3D Data Shortcuts and Xref Problems.

8. The drawing’s real origin

Some drawings are built around a local origin at a convenient point, with the coordinate system assumed or never assigned. Coordinates are small numbers, and the GIS puts them at the origin of its system. See Missing or Wrong Coordinate System in AutoCAD Drawings.

9. Source accuracy and distortion

Drawings digitized from paper, scanned plans, or compiled from sources of different dates do not match precisely. The residuals after the best fit are not small. Here, accuracy is limited by the source, and the remedy is rubber-sheeting (a local, non-uniform transformation using many control points), a new survey, or an honest statement of the accuracy.

10. Vertical differences

Elevations in different vertical datums (a local benchmark, a national orthometric datum, an ellipsoid) or units. Test with elevations at control points. A constant vertical offset points to a datum, a slope-like difference to scale or tilt.

11. Display precision

Some CAD environments draw with limited precision, and far from the origin, geometry jitters or snaps to a coarse grid. If the misfit seems to change as you pan and zoom, this is it. Work with a smaller offset and transform at the end. See BIM and GIS Integration: Revit, IFC and CityGML for the single-precision arithmetic.

12. A genuinely wrong GIS layer

Sometimes the GIS data is wrong. Test it against an independent source (an orthophoto, a survey) before blaming the drawing. And check the layer’s own coordinate system, since a Shapefile with a missing or incorrect .prj file will be placed wrongly. See Missing or Unknown Projection: How to Fix It.


The Decision Process

1. Identify control points (5 or more, well spread) in both datasets.
2. Compute the differences and fit a similarity transformation.
3. Are the residuals small?
      Yes -> the misfit is systematic. Read the fitted shift, scale and rotation (step 4).
      No  -> the source is distorted, or one control point is wrong. Remove the worst point and refit,
             or accept the limited accuracy / re-survey.
4. Match the parameters to a cause:
      shift only        -> datum, origin or false easting/northing
      scale = unit      -> units
      scale ~ 1.0003    -> grid-ground
      rotation          -> north reference, rotated UCS, wrong zone
      det < 0           -> swapped or mirrored axes
5. Confirm the hypothesis with documentation (surveyor, metadata, project coordinate agreement).
6. Apply the correct fix, then recheck the residuals at the control points AND at independent points.
7. Record what you did.

The Fixes

In AutoCAD Map 3D and Civil 3D

  • Assign the correct coordinate system to the drawing, if the coordinates are already in that system (this labels the data, and moves nothing). In Map 3D, the coordinate system assignment command does it. In Civil 3D, it is in the drawing settings. See Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained.
  • Transform, when the data must be converted from one system to another: Map 3D can transform data on import or connection, and has tools to reproject objects.
  • Fix the units (and check the INSUNITS setting), then recheck.
  • For a similarity transformation (shift, scale, rotation) between a local system and a real-world one, use a documented two-point or multi-point alignment, with the control points listed in the project record. The standard ALIGN command or a block insertion with computed scale and rotation will do it, but record the numbers.
  • Rubber-sheeting tools exist for distorted sources.

In QGIS and with GDAL

  • Assign versus transform are different operations: in GDAL, -a_srs assigns, -t_srs transforms.
  • Shift, scale and rotate vector data with the Affine transformation tool in the processing toolbox, using the fitted numbers.
  • In Python with Shapely, the same:
from shapely import affinity

# geometry: a Shapely geometry. The numbers come from the fit.
fixed = affinity.rotate(geometry, 12.0, origin=(0, 0), use_radians=False)
fixed = affinity.scale(fixed, xfact=1.0003, yfact=1.0003, origin=(0, 0))
fixed = affinity.translate(fixed, xoff=1000.0, yoff=2000.0)

(The order and the origin matter. Apply the operations in the same order that the fit assumes, and verify against the control points. I did not run the Shapely call here, so test it on a small sample.) For rasters, the half-pixel convention is its own source of error. See Aerial Imagery and Rasters in AutoCAD Map 3D and Civil 3D.

What you must not do

  • Don’t “fix” by nudging the drawing until it looks right at one spot.
  • Don’t assign a guessed coordinate system to make the layers line up. If it appears to fit, you have created a false claim about the data. Verify with several control points and the documentation.
  • Don’t transform something twice, or transform data that was already in the target system.
  • Don’t rubber-sheet legal survey boundaries. The data is evidence. See Cadastre and Land Survey: From CAD Drawings to GIS Parcels.
  • Don’t discard the original.
  • Don’t forget to record the transformation parameters, the control points and the residuals.

Checking the Result

Evidence, not hope:

  1. Residuals at the control points are within a plausible size for your data. For a surveyed drawing against a good GIS layer, a few centimeters. For a digitized plan, a meter.
  2. Independent check points (not used in the fit) agree within the same tolerance, at several places, including the far corners.
  3. Direction: the misfit has not just moved elsewhere.
  4. Heights agree, if relevant.
  5. Visual review over an orthophoto at several scales.
  6. Documentation: the method, the parameters, the points, the residuals, the person and the date.

Prevention: How a CAD Manager Stops This Call

  • A project coordinate agreement on day one: coordinate system (EPSG code), units, vertical datum, grid or ground, control points. See Civil 3D and GIS in Land Development and Surveying.
  • A template with the coordinate system assigned and units set.
  • A delivery specification for consultants and contractors.
  • A check on arrival: every drawing that enters the project has its coordinate system, units and extents read and compared with the agreement (a script, as in Batch Processing DWG Files: Core Console, Scripts and FME).
  • A control point list in the project folder.
  • Training: an hour on assign versus transform, and on grid versus ground.
  • A habit: the first thing anyone does with a new drawing is overlay it on a trusted reference at three places.

A Worked Example: The Drawing That Was 1.2 Meters Out

Situation: a road drawing in feet (state plane style coordinates) was delivered to a municipality whose GIS used meters on a national grid. After conversion, the road edges sat about 1.2 meters from the surveyed kerb in the GIS, in a consistent direction. The designer had already shifted the drawing by hand.

  1. Undo the manual shift, restore the delivered drawing and the original GIS layer.
  2. Choose six control points: surveyed kerb corners and manholes, well spread over the 3-kilometer length.
  3. Fit the similarity transformation: scale 1.0000 against the intended unit conversion, no rotation, residuals under 2 centimeters at all points, and a shift of 1.22 meters at the far end, growing with the coordinate magnitude.
  4. Diagnose: the pattern fits the 2-parts-per-million difference between the US survey foot and the international foot, at a coordinate near 2 million feet. The drawing’s coordinates were in US survey feet, and the conversion had used the international foot.
  5. Confirm with the surveyor’s metadata: “NAD83 state plane, US survey feet.”
  6. Fix: reassign the coordinate system with US survey foot units and transform properly. Recheck: residuals at the control points fall to 1 to 3 centimeters, with no growth with distance.
  7. Verify at independent points at both ends, and overlay on the orthophoto.
  8. Record the cause, the fix and the residuals, and add a line to the delivery specification: “State units explicitly: US survey foot, international foot or meter.”

Two hours, no hand-nudging, and a line in the specification that has prevented the same call since.


Common Mistakes

  • Moving the drawing by hand to make it fit.
  • Guessing a coordinate system until the layers line up.
  • Testing at one place only.
  • Using control points clustered in one area.
  • Mixing up assigning and transforming.
  • Ignoring units, and the US survey foot.
  • Forgetting grid versus ground.
  • Not checking residuals, and trusting a fit blindly.
  • Rubber-sheeting evidence such as legal boundaries.
  • Blaming the drawing without checking the GIS layer.
  • Not recording the transformation.
  • Fixing the symptom and not the delivery specification.

Best Practices

  • Diagnose before you change anything.
  • Use five or more spread control points and fit a transformation.
  • Read the fit: shift, scale, rotation, mirror, residuals.
  • Check units first, and ask which foot.
  • Verify at independent points and in several places.
  • Use official transformations for datum changes.
  • Record everything.
  • Prevent: agreements, templates, delivery specifications and checks on arrival.

Final Thoughts

The senior engineer who had moved his drawing three times was not embarrassed when I showed him the arithmetic. He was relieved. “I assumed it was something I’d done wrong,” he said. It almost never is. A misalignment is a message, written in numbers, and it tells you precisely what the two datasets disagree about: units, datum, north, scale or axes. The skill is simply to read it.

The next time a drawing won’t fit, take five points, fit a transformation, read the numbers and say what kind of error it is before you touch the data. You’ll be right most of the time, you’ll fix it permanently and you’ll have a line to add to the specification that makes sure that the phone doesn’t ring again.

Where to go next: if the drawing has no usable coordinate system at all, read Missing or Wrong Coordinate System in AutoCAD Drawings, and for the other direction of the problem, DWG Import Errors in QGIS and ArcGIS (Blocks, 3D Faces, Encoding).

Rachid Khouri

Rachid Khouri

Rachid Khouri is a CAD, BIM and GIS professional, Autodesk Authorized Developer, trainer and technical author with more than 30 years of experience, working with AutoCAD since 1992. He founded GISauthority.com to share practical guidance on GIS and spatial technologies.