I have a deceptively simple requirement to create a software component to record and update some mobile position information, then be able to perform simple queries concerning mobiles in a particular area. When I say 'mobile' think aircraft and ocean-going ships. When I say 'simple queries' think 'Give me a list of all the mobiles in some region' or 'Give me the list of all mobiles within X km of mobile Y'. A simple, yet basically complete API for this component in Java might look like this:
import java.util.List;
public interface MobileTracker {
/** Tell us that this mobile should be tracked. */
public void logonMobile( int mobileId );
/** Tell us that this mobile should no longer be tracked. */
public void logoffMobile( int mobileId );
/** Update the current position of the logged on mobile */
public void updatePosition( int mobileId, double lat, double lng );
/** Finds all of the mobiles in the given region (circular or polygon). */
public List<Integer> getMobilesInRegion( /* Region region */ );
/** Finds all mobiles within radiusKm km of mobileId's current location */
public List<Integer> getMobilesNear( int mobileId, double radiusKm );
}
I'm looking for a Java library that will help me implement this. Preferably one that is not GPL, and doesn't have a million dependencies for a bunch of other functions that I don't need.
I don't work in the GIS domain, so as I looked here for help, I find myself in terminology-overload. It seems to me I should be looking for a spatial-database. This data doesn't actually need to be persistent here, so I would prefer something I could embed and run in-memory only. This question looked promising, but after a bit of digging on the HatBox site, I see it uses JTS which uses 2-D math, which I don't think is accurate enough for my needs, as I'm dealing with distances of 100s or 1000s of km (maybe this should be another question).
My question comes down to:
Am I right in assuming I need a spatial-database, or are there better solutions? Can you make some suggestions?