Spatial information describes where physical objects and events are and how they relate geometrically. In a digital twin, it connects sensor readings to places, making it possible to ask where a condition occurs, which assets are nearby, and how physical surroundings may affect a measurement. section 4.1.4 section 5.2.1
Choose a representation that supports the decision at hand:
- Use local 2D coordinates for distances within a site; add height when vertical relationships matter. A coordinate reference system keeps locations consistent when comparing data from different sources. section 4.1.4 section 2.5
- Use a floor plan, schematic, network graph, or map when it gives sufficient context. A realistic 3D model is not a requirement. section 2.4
- Use 3D when depth, scale, or volume improves interpretation enough to justify model creation, rendering, interface, and synchronization costs. section 7.0
Find a nearby sensor
Place a person and three water sensors on the same local x,y grid. For each sensor, calculate the Euclidean distance from the person's position and retain distances of 5 meters or less. The rear garden tap is the match, at about 2.6 meters. This works without a detailed 3D model because the question only needs 2D proximity. section 4.1.4
Listing 4.1 Using spatial coordinates to perform a proximity-based search query
my_pos = (0.1, 3) #1
sensors = [ #2
{"id": "flow_meter_1", "name": "Rear garden tap", "pos":
(0.839, 0.5)},
{"id": "flow_meter_2", "name": "Front garden tap", "pos":
(0.875, 18.31)},
{"id": "water_main_meter", "name": "Main water meter", "pos":
(3.13, 21.99)},
]
dist = lambda p1, p2: ((p2[0]-p1[0])**2 + (p2[1]-p1[1])**2)**0.5 #3
print("Sensors within 5m:")
[print(f"- {s['name']}: {d:.1f}m") for s in sensors if (d := dist(my_pos,
s['pos'])) <= 5]
The Python listing shows the local coordinates, distance calculation, and 5-meter filter used in the proximity query. section 4.1.4
Location becomes more useful alongside other context. A moisture reading can be placed near a sprinkler, tracked over time, and linked to the valve and watering zone that determine an action. For display, accurately align sensor coordinates with the floor plan or other view; otherwise a reading may appear to belong to the wrong place. section 5.2.1 section 6.2.4

