Geoprox Core
A Rust crate designed for geospatial indexing and sharding. It includes two primary modules: cache and shard. These modules facilitate efficient geospatial queries and indexing for applications such as food delivery services, real-time inventory tracking, and more.
Looking for an API implementation see,
geoprox-serverfor the HTTP API version of this service andcontrib/client-sdkfor HTTP client libraries.
Features
- Geospatial Indexing: Efficiently index and search for resources based on their geographic location.
- Geospatial Sharding: Manage and query distributed datasets with geospatial awareness.
Modules
SpatialIndex
The cache module, implemented as SpatialIndex, allows for placing and searching resources based on their geohash-encoded locations. Key features include:
- Placing Resources: Add resources to the index with their geohash-encoded locations.
- Searching Resources: Perform range queries to find resources within a specified distance from a given location.
Example Usage
extern crate geoprox_core;
let mut geo_index = default;
let depth = 6; // ? determines geohash length (i.e precision)
geo_index.place_resource;
geo_index.place_resource;
let range = 1.0; // radius in kilometers
let origin = ; // lat/lng
let res = geo_index.search.unwrap;
assert_eq!;
res.iter.for_each;
GeoShard
The shard module, implemented as GeoShard, provides a mechanism for sharding datasets geographically and performing range queries. Key features include:
- Creating Indexes: Initialize geospatial indexes for different datasets.
- Inserting Keys: Insert keys into the geospatial index with their corresponding locations.
- Querying Ranges: Query the index to find keys within a specified range from a given location.
- Drop Index: Deletes the index and its associated keys.
Example Usage
extern crate geoprox_core;
let mut shard = default;
shard.create_index.unwrap;
shard.insert_key.unwrap;
shard.insert_key.unwrap;
// ? search 'drivers' within 150km radius near (1, 0.5)
let res = shard.query_range.unwrap;
println!;
Contributing
Contributions are welcome! Please see the contributing guidelines for more information.
License
This project is licensed under the Apache 2.0 or MIT License (your choice).