What you are looking at
A small city, two kilometres across, laid out in metres. Five neighbourhoods are stored as polygons and every café, gym and cinema as a point. They are ordinary property values on nodes, validated when they are written, so a shape can sit in the same record as a name or a rating.
Above the map, the same six people from the embeddings demo float as a graph: who knows whom, which places they like, and where they live. That is the point of the demo. In Galactus DB the graph and the map are one database, so a single query can follow relationships and filter by distance at once.
The containment tests, distances, grid index, overlaps and centre points are computed in your browser with the same planar maths. Each step shows the Galactus DB Cypher that answers the same question. Nothing connects to a database.
Things to try
- Click a place to see which neighbourhood it is in, using
spatial.contains. - Switch to "What is near?" and click a place to search 500 m around it.
- Click anywhere on the map to drop a pin and see what is nearby.
- Click a person to find the cafés their friends like near their home.
- Where should friends meet? takes the centre point of four homes and finds the nearest café to it.
How the point index helps
The point index divides the map into a grid. A distance search reads only the squares its circle touches, then measures the places in them exactly. However large the city grows, a 500 m search still reads only the squares around it, where a scan would read everything.
In Galactus DB
CREATE POINT INDEX placeLoc FOR (p:Place) ON (p.loc);
CALL db.index.geo.withinDistance('placeLoc', point({x: 960, y: 860}), 500)
YIELD node, distance
RETURN node.name, round(distance) AS metres ORDER BY metres;
MATCH (me:Person {name: 'Ada'})-[:KNOWS]-(f:Person)-[:LIKES]->(c:Place {kind: 'Café'})
WHERE point.distance(c.loc, me.home) <= 800
RETURN c.name, collect(DISTINCT f.name) AS likedBy;
Galactus DB returns overlap shapes from spatial.intersection; the shares of the
delivery zone shown in the demo are worked out in the browser from their areas.
