Geoprox Core
A Rust crate designed for geospatial indexing and sharding. It includes two primary modules: cache and shard. These modules provide 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.
Data Stuctures
SpatialIndex
The cache module implements the SpatialIndex data structure, enabling efficient placement and searching of 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;
// ? place object keys into index
geo_index.insert;
geo_index.insert;
// ? search index for objects near New York
let nearby: LatLngCoord = ;
let within: f64 = 200.0; // 200km radius
let count = 100; // return up to 100 results
let sorted = true; // sort results by distance
let depth = 6; // ? determines geohash length (i.e precision)
let res = geo_index.search.unwrap;
println!;
assert_eq!;
res.iter.for_each;
GeoShard
The shard module implements the GeoShard data structure, which facilitates geographical sharding of datasets and enables efficient 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;
// ? create an index to store driver coordinates
shard.create_index.unwrap;
// ? place drivers into index
shard.insert_key.unwrap;
shard.insert_key.unwrap;
// ? search drivers near Japan
let nearby: LatLngCoord = ;
let within: f64 = 50.0; // 50km radius
let count = 100; // return up to 100 results
let sorted = true; // sort results by distance
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).