Here is the function I need to implement. My application deals with mobile objects with variable position and range (think of radar range). As I can't test each minute if n mobiles detect each other (server would be overloaded), I need to precalculate "future" position and time when they'll detect each other from their planned route and only register the "future" event in a stack. Each time a user changes the planned route, I'll recalculate event related to all intersecting routes from other mobiles.

The best way to do that is to make a kind of 4D intersection request and update, and be able to detect when and where mobiles will "collide".

Is it possible with a classic geodatabase like PostgresQL+PostGis and another plugin, or do I need to look at specific n-dimensional database ?


This can be done with PostGIS's ST_LocateBetween function, where you can extract point and linestrings from either a single time or between a range of times. To do this, you need to have geometries with a measure dimension, that is [Multi]Point [Z]M or [Multi]LineString [Z]M geometries. A numeric timestamp (e.g. Unix time) can be used for the M-dimension.

For example, this 4D point is captured at M=4:

SELECT ST_AsText(ST_LocateBetween('POINT ZM (1 2 3 4)'::geometry, 4, 4))

 MULTIPOINT ZM (1 2 3 4)
(1 row)

And if it doesn't intersect the M range, it will return MULTIPOINT ZM EMPTY, which can be filtered out of a query with ST_IsEmpty.

  • To be more precise on my use case : imagine objects moving along a path. The objects are defined by a MLineString (list of MCoordinate) and an Integer (circle radius). I would like to know when two objects.circle will collide and where each object are when collision occurs. I need to interpolate position and time between two MCoordinate. It seems that in your sample, i'll get only defined points.
    – Zofren
    Sep 13 '14 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.