GeoNode

Geospatial data structure for location-based spatial entity analysis

Learn what it is

GeoNode

Package location

com.fractalworks.streams.processors.geospatial.structures

Class Definition

class GeoNode<T extends ReferenceData> implements Coordinates, ReferenceData

Constructors

// Default constructor
public GeoNode()

// Create a node with location details and add entity later
public GeoNode(double latitude, double longitude)

// Create a node with location details and a reference data type
public GeoNode(double latitude, double longitude, T entity)

Key Methods

Get coordinates

Get entity unique key

Get entity

Example

The example demonstrates using the GeoNode class to store and query geospatial data.

This example demonstrates how to associate spatial data with entities and efficiently query nearby locations.

  1. Friend class A Friend object stores details (ID, name) of a person.

  2. GeoNode instances Each GeoNode<Friend> links a Friend to specific geographical coordinates (latitude, longitude).

  3. QuadTree The GeoNode instances are added to a QuadTree, which indexes the locations for efficient querying.

  4. GeoFence A GeoFence is created around a specific location with a radius (2 units).

  5. Querying The QuadTree is queried for GeoNode objects within the GeoFence, returning nearby friends.

  6. Display results The nearby friends are printed to the console.

Last updated

Was this helpful?