Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEO / GIS queries #278

Open
joepio opened this issue Jan 7, 2022 · 0 comments
Open

GEO / GIS queries #278

joepio opened this issue Jan 7, 2022 · 0 comments

Comments

@joepio
Copy link
Member

joepio commented Jan 7, 2022

Atomic Server basically supports three indexes as of now: full-text search, a value index, and subject index. If we want a performant way for users to see items on a map, we'll need a different kind of index.

Approaches

Leave out of scope (current option).

Scope creep. GIS features are a whole thing. There's a whole bunch of standards in this domain that people may expect (like wms of wfs).
Even if we build a performant index for GEO queries, we still only support one specific GEO related feature.
We will still miss things like:

  • Server-side rasterization (heatmaps)
  • Counts / aggregates
  • Shapes / polygons

Use starts_at / range queries sorted by lat / long value

Our current index already allows for range queries. By running two range queries and combining the results we can already do geo queries.

However, this may break down if we do queries closer to the poles perhaps.

Find existing embeddable solution

List of useful tools, but nothing that really looks like what I'm searching for.

Custom / clever KV spatial index(es) using sled

Geohashing

Convert latitude and longitude into a geohash string. Geohashes have the property that prefixes of the hash represent larger areas, with each character added to the hash refining the location to a smaller region. This allows for efficient range queries by querying keys with the same prefix.

Screenshot 2024-02-08 at 11 19 18

This geohash crate can come in useful.
When we process a commit, we check added or set properties with a geo datatype. When we find these, we update the geo tree index, which contains all geo resources (for a certain drive?).

Quadtree encoding

Morton Encoding

Convert each (latitude, longitude) pair into a Morton code and use these codes as keys in your Key/Value store. Range queries can be performed by calculating the Morton codes for the corners of the query region and retrieving keys within this range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant