🤖 AI Summary
This study addresses the substantial computational overhead of spatial context construction in trajectory prediction, which has become a performance bottleneck for large-scale track processing. The work formalizes exact spatial context retrieval as a core database problem in trajectory analysis and proposes an efficient architecture based on composable indexable operators, integrating MBR overlap queries, a learned range index (BR-LZ), and Signed Distance Fields (SDF) for compressed storage. Evaluated on a dataset of 5.48 million anchor points, the method reduces context construction time from 17 CPU-days to 1.8 hours, achieving a 226× end-to-end speedup. It also attains a 64× compression ratio in SDF storage with only 0.04 meters of accuracy loss, while guaranteeing lossless recall and low candidate amplification.
📝 Abstract
Modern trajectory predictors increasingly condition on external spatial context, such as map geometry, signed distance fields (SDFs), and nearby moving agents. While this context improves prediction quality, constructing it for every training anchor has become a hidden systems bottleneck. In a representative maritime AIS pipeline, spatial context construction requires roughly 17 CPU-days for a 5.48M-anchor corpus, dominating the cost of the downstream predictor. We present M-CTX, an exact and scalable spatial context-retrieval framework for trajectory analytics. M-CTX recasts context construction as an ingest-once, query-many spatial database workload and replaces three brute-force stages -- OSM range retrieval, SDF computation, and moving-vessel neighbour lookup -- with composable, index-backed operators. Its learned range-index backend, BR-LZ, provides recall-complete MBR-overlap range retrieval and reduces candidate amplification by 1.1x--2.7x relative to global-expansion one-curve baselines. Across four maritime regions, eight baseline systems, synthetic workloads with up to 40M spatial features, and 10^7-record AIS streams, M-CTX reproduces the reference context exactly. On the 5.48M-anchor corpus, it reduces context construction from about 17 CPU-days to 1.8 hours, a measured 226x end-to-end speed-up. An optional storage mode further compresses SDF context by 64x with only a 0.04 m ADE change. These results establish exact spatial context retrieval as a first-class database problem in modern trajectory analytics. Code and datasets are publicly available at https://github.com/mark000071/M-CTX-Traj.