Geo-Assist – An in-memory spatial engine to store and query spatial data
github.com
github.com
Some examples:
- redis has support for geospatial. Good for radius searches.
- elasticsearch/opensearch have pretty elaborate options for disance search, ranking, aggregating, etc. It can also deal with geojson geometry and do polygon intersection/containment queries, etc.
- mongodb has similar features for geojson but is probably a bit more limited for querying/ranking/aggregating.
- postgis is a bit of a beast but a goto solution for doing complex geospatial work.
There are many more options of course. Just making the point that this isn't a wheel that is in a lot of need of reinventing.
For example, polygonal dictionaries allow doing coordinate-to-region lookups using the indexed data structure. It is used for mobile app analytics and ride-sharing apps.
https://clickhouse.com/blog/real-world-data-noaa-climate-dat...
Reverse geocoding is a task requiring quite sophisticated algorithms to implement it optimally. It's worth a dedicated blog post... You can check the source code: https://github.com/ClickHouse/ClickHouse/. See src/Dictionaries/Polygon Dictionary Implementations.h
The author does not claim this should be used in production. As far as I can tell, this appears to be more of a novelty technical demo more than anything. Saying that the author is trying to reinvent the wheel of production-grade databases is uncharitable at best.
It’s true that alot of databases that have “Support for Geospatial” - but that can mean a a lot of things, often with little overlap in functionality, or very specific, inflexible access patterns that breakdown with even small variations in the problem.
I don’t think it’s too uncommon to find that none of the available solutions work for particular real world problems, and often it comes down to handcrafted solutions like this.
But why design Point so that you have to do:
`Point point = new Point.Builder() .latitude(25.2012544) .longitude(55.2569389) .build();`
Instead of:
`Point point = new Point(25.2012544,55.2569389)`
Cool project btw... working with geospatial data can be fun.
I personally like static methods.
Point point = Point.fromLonLat(55.25…, 25.20…);
The builder pattern is useful to set defaults and add features without breaking backward compatibility.
Ah, that is interesting. Did not think about that.
Although agreed it's used when you start to get to more parameters. I didn't check but it's possible there are a lot of null/default values like projection or something.
In creating a Point, neither value is optional, so I would question the value versus the additional complexity in this case.
`kdTree.findNearestNeighbor(point, 2);` does this return
1. A list of ALL points that match the distance predicate?
2. Are they sorted by distance to the target?
3. Is it possible to cap to only the closest N points?
I would like to have your input and have the better understanding of what you are looking for as well.
I used an in-memory RTree in Golang [0]. It's super fast and efficient.