Spatial information describes where assets or events are and how they relate geometrically in 2D or 3D space. In a digital twin, it connects measurements to physical places, enabling proximity searches, location-aware analysis, and visualization. section 4.1.4 section 5.2.1
A location can be relative to another object, a site, or Earth. A spatial reference system provides the framework for representing and comparing locations consistently. Local coordinates suit site calculations but complicate integration with external data; geographic coordinates locate points on Earth but complicate distance calculations because of Earth’s curvature. section 2.5 section 2.5.1
Find nearby sensors
A home digital twin places three water sensors in a 3D mesh using local x,y coordinates. To find sensors within 5 meters of a person, calculate the Euclidean distance from the person to each sensor and retain distances at or below the threshold. The rear garden tap is 2.6 meters away. The 2D calculation is sufficient here; a more complex environment could include height as a z-axis. 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 calculates distances from a local position and filters the sensors within 5 meters. section 4.1.4
Spatial context also helps explain readings. A temperature sensor’s position near a west-facing window can help account for afternoon spikes. On a floor plan, placing a reading at the sensor’s coordinates shows where a condition occurs rather than leaving it as an abstract value. Accurate alignment with the floor plan’s coordinate system is essential. section 5.2.1 section 6.2.4
Choose the representation for the decision, not for visual realism alone. A floor plan, schematic, network graph, map, or structured building model may provide enough context. A 3D view can make height, depth, and vertical relationships directly visible, but model creation, rendering, interface complexity, and synchronization introduce costs. section 2.4 section 7.0

