Spatial Analysis in AutoCAD Map 3D: Topology, Queries and Overlays

Spatial Analysis in AutoCAD Map 3D: Topology, Queries and Overlays

A water utility asked me a question that sounded simple. “If valve V-114 fails and has to be closed, which customers lose water, and which hospitals are among them?” The utility’s records lived in about four hundred drawings, one for each district, drawn over thirty years by different people. There was no database. There was no network model. There was a team of draftsmen who, in an emergency, would spread out the paper plans, trace the pipes with a finger and a highlighter, and phone each other. In the best case the answer took an hour. In the worst case, nobody was sure.

Two weeks later, the same question took forty seconds. We had cleaned the drawings, built a network topology of the pipes and valves inside AutoCAD Map 3D, attached customer connection points as object data, and written a trace: starting from the valve, follow the pipes downstream until you reach another closed valve, and select everything on the way. The selected customers appeared on the screen, highlighted. A query on the object data found the hospitals among them. Nothing about the exercise was exotic. It used three of the plain tools in Map 3D: topology, queries and overlays. But it turned a drawing archive into something that could answer a question.

That’s the territory of this guide. Map 3D isn’t a full GIS, and I won’t pretend that its analysis tools rival ArcGIS Pro or QGIS. But for the kind of analysis that design and drawing-based organizations actually need (which parcels does this route cross, what is upstream of this valve, what lies inside this zone), its built-in tools are often enough, and they work where the data already lives, in the drawing. In this guide I’ll explain the three families of tools, how they work together, when they suffice and when to go elsewhere, with worked examples, SQL equivalents for the GIS side, and the mistakes that produce confident wrong answers.

It is part of our Autodesk series. For the program itself, see AutoCAD Map 3D Beginner’s Guide. For the preparation that all analysis depends on, see Drawing Cleanup in AutoCAD Map 3D Explained. For the general methods behind everything here, see Spatial Analysis in GIS: Complete Guide.

A note on facts: tool names, dialogs and options vary between Map 3D versions. I describe the concepts and the usual locations. Check the documentation for your version.

Illustration: Map 3D can run overlay operations on objects in a drawing, such as buffer and intersect.
Map 3D can run overlay operations on objects in a drawing, such as buffer and intersect.

The Analytical Toolkit at a Glance

FamilyWhat it answersTypical tools
QueriesWhich objects meet these conditions, by location, property or data?Define query, query by location, property and data conditions, saved queries
TopologyHow are objects related, such as what connects to what, and what is adjacent to what?Node, network and polygon topologies
Network tracingWhat is upstream, downstream, connected or the shortest path?Network topology tracing tools
OverlayWhat results from combining polygon layers?Intersection, union, identity on polygon topologies
BuffersWhat lies within a given distance?Buffer creation around objects
Data and themesHow do values vary, and how can I see them?Object data tables, themes in the Display Manager, data extraction
Measurement and quantitiesHow many, how long, how large?Properties, object data calculations, data extraction

The three that matter most, and that this guide concentrates on, are topology, queries and overlays.


Why Analysis Needs Clean Geometry

Before any tool, a warning that I will repeat several times: spatial analysis is only as good as the geometry beneath it.

  • A network trace stops wherever two pipes fail to connect.
  • An overlay produces slivers and gaps wherever boundaries nearly, but not exactly, coincide.
  • A query by area misses objects whose shapes aren’t closed.
  • A buffer along a line that has a hundred tiny segments behaves differently from a line with two.

Drawings made for plotting are usually clean enough for the human eye and not clean enough for analysis. Cleanup comes first. See Drawing Cleanup in AutoCAD Map 3D Explained and Fixing Topology Errors and Overlaps. Also check the coordinate system and units, since distance-based tools such as buffers use the drawing’s units. See Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained.


Part One: Queries

What a query does

A query selects objects, either in the active drawing or in attached source drawings (a drawing set), according to conditions, and brings them into the active drawing for viewing, editing or export. See AutoCAD Map 3D Beginner’s Guide for the drawing-set concept.

The kinds of conditions

You can combine several conditions with logical operators (and, or, not).

  • Location conditions: objects inside a boundary, crossing it, touching it, or within a distance of a point, a line or a polygon. For example, every parcel that intersects the proposed route.
  • Property conditions: the object’s layer, color, line type, object type and other drawing properties. For example, all polylines on the layer “WM-PIPE”.
  • Data conditions: the values of object data or other attached data. For example, pipes with diameter greater than 300 and material equal to “concrete”. See Object Data, Object Classes and Attributes in AutoCAD Map 3D.
  • SQL-style conditions, for combining and testing values with expressions, where the tool allows.
  • Combinations, such as “pipes on the layer WM-PIPE, within the study area, installed before 1980”.

What you can do with the results

  • Bring the objects into the active drawing, as copies, for editing or design. When you do this, record where they came from and when.
  • Save edits back to the source drawings, if the workflow is designed for it.
  • Highlight them, count them, measure them (total length, area) and extract their data into a table.
  • Export them to GIS formats. See Importing and Exporting GIS Data in AutoCAD Map 3D.
  • Theme them, using their data, for a quick map.
  • Save the query and reuse it.

Good practice for queries

  1. Restrict by location first, to avoid pulling huge amounts of data.
  2. Name and save the queries you will reuse, so that analyses are repeatable.
  3. Query into a new drawing when you are only analyzing, to protect the source.
  4. Be careful with “save back”. Editing sources that other people rely on needs rules, backups and permissions.
  5. Check the result count. Zero results usually means a wrong layer name, wrong data field or a coordinate mismatch. A very large result often means a missing location condition.
  6. Document the conditions you used, since they define what the answer means.

Example: parcels crossed by a proposed corridor

  1. Draw the corridor polyline, and create a buffer around it with the desired width (say, 15 meters on each side).
  2. Define a query on the attached parcel drawings (or the connected parcel layer): parcels that intersect the buffer polygon.
  3. Run it and bring the parcels into the active drawing, with their object data.
  4. Extract the owner and area into a table, and compute the affected area for each parcel.
  5. Theme the parcels by ownership type for the consultation map.
  6. Export to a GeoPackage for the GIS team.

The same analysis in PostGIS, if the parcels live in a database:

-- Parcels crossed by a 15 m corridor buffer, with the area of overlap
WITH corridor AS (
  SELECT ST_Buffer(geom, 15) AS geom FROM route WHERE route_id = 'R1'
)
SELECT p.parcel_id, p.owner,
       ST_Area(p.geom) AS parcel_area_m2,
       ST_Area(ST_Intersection(p.geom, c.geom)) AS affected_area_m2
FROM parcels p
JOIN corridor c ON ST_Intersects(p.geom, c.geom)
ORDER BY affected_area_m2 DESC;

(Both layers must share the same projected coordinate system, in meters.) See Spatial SQL Cheat Sheet.


Part Two: Topology

What topology gives you

A drawing is a collection of independent shapes. A topology is a layer of relationships built on top of them: which lines meet at which nodes, which polygons share which boundaries. Once the relationships exist, you can ask questions that depend on them. Map 3D supports three kinds.

Node topology

Node topology records points and their relationships with the lines that touch them. Use it for point-to-line questions: which valves sit on which pipes, which poles connect to which lines, which junctions have how many incoming links.

Network topology

Network topology records lines connected at nodes, forming a network, and lets you trace through it. Use it for pipes, cables, roads and rivers. Typical analyses:

  • Trace upstream and downstream from a point (such as a valve, a manhole or a spill location).
  • Find the shortest path between two points, with a cost (length, or a field you define).
  • Find all connected objects, to detect isolated parts of a network.
  • Identify dead ends, loops and unconnected segments.
  • Find the objects within a travel cost of a point (service areas), in some configurations.

For a network topology to work, the lines must truly connect at their endpoints (or at vertices that the topology treats as nodes), within the tolerance you set. Connection errors are the number-one cause of traces that stop early.

Polygon topology

Polygon topology builds polygons from boundaries and records which polygons are adjacent, which share edges, and which contain which. Use it for parcels, zones, administrative areas and land use. It supports:

  • Area and perimeter calculations that are consistent.
  • Adjacency questions, such as which parcels border the park.
  • Overlay between topologies.
  • Detection of gaps and overlaps, because the polygons are derived from shared boundaries, gaps appear as holes and overlaps as errors.

Building a topology: the sequence

  1. Clean the drawing, at least the objects to include.
  2. Select the objects (by layer, type or query) that will form the topology.
  3. Choose the type (node, network, polygon), and the tolerance for connection.
  4. Name the topology and decide where it is stored. Topologies are saved with the drawing or in a separate file, depending on version and setup.
  5. Create it, and inspect the error report: unconnected objects, overlaps, undershoots, and so on.
  6. Fix errors in the drawing, and rebuild or update the topology.
  7. Run the analysis.
  8. Document the topology, the tolerance and the date.

The tolerance decision

The tolerance is the distance within which two points are considered the same node. Choose it with care:

  • Too small: connections that should exist don’t, and traces stop.
  • Too large: unrelated points merge, and false connections appear.
  • A useful approach: look at the actual distribution of gaps between nearby line endpoints in your data. Genuine near-misses usually form a cluster of very small distances. The tolerance should sit just above that cluster, and well below the size of the smallest real feature.

You can examine gaps with a few lines of Python, on endpoints exported from the drawing:

import numpy as np

# endpoints: an (n, 2) array of x, y coordinates of every line start and end, in meters
def nearest_endpoint_gaps(endpoints):
    gaps = []
    for i, p in enumerate(endpoints):
        d = np.hypot(*(endpoints - p).T)
        d[i] = np.inf
        gaps.append(d.min())
    return np.array(gaps)

gaps = nearest_endpoint_gaps(endpoints)
near = gaps[gaps < 2.0]                       # only consider gaps below 2 m
counts, edges = np.histogram(near, bins=[0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.5, 1.0, 2.0])
for lo, hi, c in zip(edges[:-1], edges[1:], counts):
    print(f"{lo:4.2f} to {hi:4.2f} m: {c}")

Look for the cluster of small gaps, which represent the “intended connections”, and for the quiet zone beyond it. Use judgment, then test on a small area and inspect. For large datasets, use a spatial index (for example, in a database). See Fixing Topology Errors and Overlaps.


Part Three: Network Tracing

Network tracing is the most valuable application of network topology, and the one that my utility cared about.

Common traces

  • Upstream trace: everything that feeds a point. Used to find the source of contamination, or the pipes that feed a failing pump.
  • Downstream trace: everything that is fed by a point. Used to find who is affected by an outage or a spill.
  • Isolation trace: the valves that must be closed to isolate a section, and the customers affected. (This requires valve data and rules about open and closed states.)
  • Shortest path: the shortest, or lowest cost, route between two points.
  • Connectivity check: whether every pipe is connected to the source. Isolated pieces indicate errors or genuine separate networks.

What a trace needs

  • Connected lines, with node tolerance respected.
  • Direction, for upstream and downstream: either implied by the geometry (digitized in the direction of flow) or stored as an attribute. A frequent failure: pipes digitized in random directions.
  • Barriers, such as closed valves, if you want them to stop the trace.
  • Attributes to identify results: IDs, customer counts, importance.

Example: the valve question, in outline

  1. Clean the pipe drawings, and snap endpoints so that the network connects. Check for disconnected pieces.
  2. Build a network topology of the pipe lines, with a tolerance based on the gap analysis.
  3. Attach valve points and customer connection points, with object data (ID, customer name, type, priority).
  4. Orient the pipes in the direction of flow (a one-off task, with checks).
  5. Run a downstream trace from the failed valve, stopping at other closed valves.
  6. Select the customer points on the traced pipes, and query the data for “hospital” or “critical”.
  7. Output the list and a map: customers affected, critical customers, pipes and valves involved.
  8. Verify with the operations team on a few known cases, and refine the rules.

A well-prepared network turns that into a routine report. An unprepared one turns it into the afternoon with the highlighters.

The same trace in SQL, for the database version

If the network lives in a database with from-node and to-node fields, an upstream trace is a recursive query:

-- Pipes upstream of node N5 (pipes whose water eventually reaches N5)
WITH RECURSIVE up(pipe_id, from_node, to_node, depth) AS (
  SELECT pipe_id, from_node, to_node, 1
  FROM pipes
  WHERE to_node = 'N5'
  UNION ALL
  SELECT p.pipe_id, p.from_node, p.to_node, up.depth + 1
  FROM pipes p
  JOIN up ON p.to_node = up.from_node
)
SELECT pipe_id, depth FROM up ORDER BY depth, pipe_id;

On a small test network, this returns the nearest pipes first and then those further upstream. For networks with loops, add protection against infinite recursion, such as tracking visited nodes. Specialized network models in utility GIS platforms offer much richer tracing. See GIS in Utilities, Transportation, and Logistics, Network Analysis and Route Optimization and PostGIS: A Practical Introduction.


Part Four: Overlays

What an overlay does

An overlay combines two polygon topologies into a new set of polygons, with the attributes of both. It answers questions of the form “what is where, when I put these two layers together?”

The usual operations:

  • Intersection: the areas that are in both layers. Example: the parts of parcels that lie within the flood zone.
  • Union: all the areas of either layer, split wherever the boundaries cross, with the attributes of both where they overlap.
  • Identity: all the areas of the first layer, split by the second, keeping the attributes of the second where they overlap. Example: all parcels, with the flood zone class added wherever they are flooded.

(Map 3D’s overlay tools are built on polygon topologies, so you have to build them first. Check which operations your version offers.) See Buffer, Clip, Intersect, Union: Overlay Tools Explained for the concepts.

Worked example: parcels in the flood zone

  1. Prepare both datasets: the parcel drawing and the flood zone polygons. Clean them, close the polygons and check that they are in the same coordinate system.
  2. Build polygon topologies for each, with a suitable tolerance, and review the error reports. Fix gaps and overlaps.
  3. Run the overlay, with an intersection (to get only the flooded parts) or an identity (to keep all parcels, with the flood class attached).
  4. Inspect the result for slivers. Tiny polygons along boundaries that nearly coincide are artifacts, and not real features. Remove them with a minimum-area threshold, or by merging them into neighbors.
  5. Calculate areas for each resulting polygon, and summarize by parcel: flooded area, flooded percentage and flood class.
  6. Theme the result by flood percentage.
  7. Export the table and the polygons to the GIS or to the client.
  8. Document the sources, dates, tolerances and the sliver rule.

The equivalent area-weighted summary in SQL:

SELECT p.parcel_id,
       ST_Area(p.geom) AS parcel_m2,
       COALESCE(SUM(ST_Area(ST_Intersection(p.geom, f.geom))), 0) AS flooded_m2,
       ROUND(100 * COALESCE(SUM(ST_Area(ST_Intersection(p.geom, f.geom))), 0)
             / ST_Area(p.geom), 1) AS flooded_pct
FROM parcels p
LEFT JOIN flood_zones f ON ST_Intersects(p.geom, f.geom)
GROUP BY p.parcel_id, p.geom
ORDER BY flooded_pct DESC;

(If the flood polygons overlap each other, dissolve them first so that the same area isn’t counted twice.)

The sliver problem

Overlays between layers that come from different sources, such as a surveyed parcel boundary and a flood zone digitized from a map, create slivers where boundaries run almost together. They inflate counts and distort statistics. The remedies:

  • Snap or conflate boundaries that should coincide, before the overlay.
  • Set a minimum area below which polygons are removed or merged.
  • Check the result visually, especially along shared boundaries.
  • Remember accuracy: if the flood boundary is accurate to 20 meters, a 3-meter sliver means nothing.

See Fixing Topology Errors and Overlaps.


Part Five: Buffers

A buffer creates a zone at a specified distance around objects: points, lines or polygons.

Typical uses

  • Corridors: 15 meters around a proposed route, to find affected parcels.
  • Protection zones: 50 meters around a stream, or around a pipeline easement.
  • Service coverage: 300 meters around a hydrant.
  • Noise or safety distances.

Cautions

  • Distance is in the drawing’s units, and meaningful only in a projected coordinate system. A buffer of “15” in a drawing with degrees as coordinates is 15 degrees. See Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained.
  • Straight-line distance isn’t travel distance. For access, use network analysis. See Network Analysis and Route Optimization.
  • Overlapping buffers need to be merged (dissolved) before you count areas, or you count the overlap twice.
  • Round and flat ends: choose the buffer style to suit the purpose. A buffer around a line has rounded ends by default in many tools, which may include areas that you don’t want.
  • Curves in a buffer are approximated by segments. Choose a sensible resolution.

Part Six: Data, Themes and Quantities

Analysis in Map 3D is not only geometric. A great deal of useful work is tabular.

  • Extract data into a table, for objects in a selection, including object data, properties, length and area. Export it to a spreadsheet for sums, counts and charts.
  • Calculate quantities: total length of pipes by diameter, number of valves by type, area of each parcel.
  • Theme the data in the Display Manager, which is analysis by visualization: color pipes by age, parcels by owner, zones by risk. See Mapping and Plotting in AutoCAD Map 3D: Styles, Thematic Maps and Map Book.
  • Check quality with queries: pipes with no diameter, values out of range, duplicated IDs.

A quick pandas check of a data extraction exported to CSV:

import pandas as pd

df = pd.read_csv("pipes_extract.csv")

print(df.groupby("MATERIAL")["LENGTH_M"].sum().round(1))          # total length by material
print(df["DIAMETER_MM"].describe())
print("missing diameter:", df["DIAMETER_MM"].isna().sum())
print("implausible years:", df[(df["YEAR"] < 1900) | (df["YEAR"] > 2026)].shape[0])
print("duplicate IDs:", df["PIPE_ID"].duplicated().sum())

See Python for GIS: Getting Started for the setup.


What Map 3D Does Not Do: Knowing When to Go Elsewhere

Map 3D’s analysis is project-scale, vector-based and basic. Use a GIS when you need:

A sensible division of labor: do the design-oriented, drawing-based analysis in Map 3D, and do the heavy or repeatable analysis in a GIS, exchanging data in open formats. See AutoCAD Map 3D vs. ArcGIS Pro vs. QGIS: Which Should You Choose?


Validating Your Results

Analysis tools produce numbers confidently, whether or not the inputs deserve it. Build the habit of checking.

  1. Check the inputs: coordinate systems, units, geometry validity and topology error reports.
  2. Check counts: does the number of selected objects make sense? Compare with a manual count in a small area.
  3. Check totals: the sum of the overlay pieces’ areas should equal the area of the input polygon (within a tiny tolerance).
  4. Check a few cases by hand, especially at the extremes.
  5. Cross-check with another tool: run the same overlay in QGIS or PostGIS for a sample, and compare.
  6. Look at it: the best test is your eyes on a map.
  7. Review the sensitivity: how much do the results change with the tolerance, the buffer distance or the minimum area?
  8. Document the method, the parameters and the data versions, so that someone else can repeat it.

A Worked Example: A Corridor Impact Study, Start to Finish

Task: a municipality is considering a 4-kilometer cycle route. The council wants to know how many parcels it affects, how much private land is needed, whether the route crosses flood-prone areas or protected habitat, and which segments are the most constrained.

  1. Set up: a Map 3D drawing in the project’s projected system, with the coordinate system assigned and units confirmed.
  2. Connect the data: the cadastre (live, from the municipal database), the flood zones, the protected habitat polygons, the existing roads and a recent orthophoto. Check alignment against survey control.
  3. Draw the route as a polyline, from the designer’s alignment.
  4. Buffer it by the required corridor width (6 meters in total, 3 meters either side) to create the corridor polygon.
  5. Query: parcels intersecting the corridor. Bring them in, with their owner, type and area.
  6. Overlay: build polygon topologies for the corridor, flood zones and habitat, and run intersections to find the exact areas of overlap. Remove slivers below a stated minimum area.
  7. Quantify: for each parcel, the affected area and percentage. For the whole route, the total private land, the total public land, the length within the flood zone and the length within habitat.
  8. Segment the route: divide it into 200-meter sections (for example with divide-by-length tools), and tag each section with the number of parcels crossed and the constraint flags.
  9. Theme the route by constraint level, and the parcels by owner type, for the consultation map.
  10. Validate: compare with an independent calculation in QGIS for three sections, check the sum of areas, and review the map with the designers.
  11. Report: a table by parcel, a table by segment, a map and a note on method, data sources, dates and limitations.
  12. Archive: the drawing, the queries, the topologies and the exported GeoPackage, in the project folder. See Autodesk Docs and Construction Cloud for Geospatial and CAD Data.

The study used queries, buffers, topology and overlays, and nothing else. It took a day, and the council asked for a second route to be analyzed the following week. Because the steps were saved, the second one took an hour.


Common Mistakes

  • Analyzing dirty geometry, and trusting the results.
  • Ignoring the coordinate system and units, so that buffers and areas are meaningless.
  • Choosing the topology tolerance by guess.
  • Pipes digitized in random directions, then tracing “downstream”.
  • Not checking the topology error report.
  • Leaving slivers in overlay results, and counting them.
  • Counting overlapping buffers twice.
  • Querying without a location condition and pulling a whole dataset.
  • Saving edits back to shared source drawings without a process.
  • Treating straight-line distance as access.
  • Using Map 3D for heavy analysis that a GIS does better.
  • Not recording parameters, so that nobody can repeat the analysis.
  • Skipping validation.
  • Presenting results with more precision than the data supports.

Final Thoughts

When we gave the utility their forty-second answer, the operations manager looked at the screen for a while. “It was always possible,” he said. “We just never had the drawings in a state where the computer could do it.” He was right. The analysis tools in Map 3D are modest, and the effort that made them work was not in the tools. It was in the cleanup, the connections, the attributes and the discipline that turned drawings into data.

That is the lesson to carry into your own work. Pick one question your organization asks repeatedly and answers by hand: what is upstream, who is affected, what lies within, which parcels are crossed. Ask what the drawings would need in order for the computer to answer it. Then do that, and let the tools do the rest.

Where to go next: prepare your data with Drawing Cleanup in AutoCAD Map 3D Explained, and see the engineering side of analysis in Surfaces and TIN Models in Civil 3D: Slope, Volumes and Watersheds.

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.