Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Memory database that supports Spatial Query

I am trying to solve the problem of "Find point of interest near you" in java. i.e. I have a number of lat,lots of points of interst. And I want to find the ones within say 800 meters. Assuming I know my current lat and log.

My problem is this application has to be stand alone. So I cannot rely on a spatial database query to find the results e.g. using mysql I have found this to be useful: http://xebee.xebia.in/2010/10/28/working-with-geolocations/

Currently I cannot find an in memeory db that supports spatital queries. I was going to resort to using an R-Tree something like http://jsi.sourceforge.net/

But I know that won't be as correct giving the fact it uses a rectange rather than a ciricular search.

Any have any recommendations?

like image 625
dboyd68 Avatar asked Apr 22 '12 22:04

dboyd68


People also ask

Which is known as spatial database?

A spatial database — also known as a “geospatial database” — is built to capture and store the points, lines, and areas of cartographic information that we refer to as spatial data.

Which of the following is the type of spatial query?

Spatial database mainly contain representation of simple geometric objects such as 3D objects, topological coverage, linear networks and TINs(Triangulated irregular networks). There are mainly three types of spatial queries as given below. Nearness queries: It request objects that present near a specified location.

Which databases are in-memory?

In-memory databases are purpose-built databases that rely primarily on memory for data storage, in contrast to databases that store data on disk or SSDs. In-memory data stores are designed to enable minimal response times by eliminating the need to access disks.


2 Answers

There is an In-Memory Database named Altibase which supports Spatial features. It observes OGC specification. You may make use of it.

like image 150
Pae Munkyu Avatar answered Oct 31 '22 22:10

Pae Munkyu


Actually the jsi library (http://jsi.sourceforge.net) is pretty much perfect for this problem. It was written to support this exact scenario.

When searching for nearby rectangles (or points) you can supply a maximum distance, and it will return the results in order of increasing distance.

It doesn't support the query "return every point within radius of 800m", but in practice you'll want a limit. So the jsi library does support the more useful "return the nearest 50 points within a radius of 800m".

If you really do want every point within a radius, you can increase the number of points to a large number and run a nearestN query, or do an intersection query and filter by distance in your own code.

like image 35
Aled Avatar answered Oct 31 '22 22:10

Aled