I didn’t find anything about geohashes in the forum and I thought it would be nice to start a conversation.
I was reading this article about solving geospatial problems in FaunaDB. The author relies on the s2-geometry JavaScript package to encode geohashes from latitude and longitude positions.
He also created an NPM package to filter out results by geohashes and calculate distances but it has some limitations. For example, you need to perform (and pay for) multiple read ops for finer filtering.
Geospatial data and querying is such a common need that it would be awesome if FaunaDB provided bult-in capabilities:
Having a native GeoPoint type that could be converted to lat/long (eg: to put a pin on a map) or geohashes
Having native functions to filter by distance, calculate distance between 2 points, box queries, etc.
Postgres already has a solution for these problems which makes working with geospatial data a trivial problem. See how Hasura leverages that (they’re huge in the GraphQL world).
It’s definitely a valid feature request. I don’t think we have any plans for geohashes since it’s quite a specific use-case. In the immediate future there are probably bigger fish to fry.
I am going to add it in a ticket as a feature request to make sure your feedback doesn’t get lost and is picked up once there is room for such a feature
Yeah, I totally get that it’s not an immediate priority. It would be killer to have a serverless geospatial DB with those capabilities. I don’t think anything like that exists in the market.
Firebase has a Geopoint data class but it’s only for storing lat/long. You need to do everything else yourself (see this video). Also, Firebase is not distributed like Fauna.
Elastic has geo points too, but I think only box type of queries (get all the points inside a rectangle). I’m not sure it qualifies as serverless… and again it’s not distributed.
Hi @Friso - no update on official supports, but a couple approaches that might help.
The blog and npm package that @pier linked in the original post are probably the best way to get this going today.
We’re working on a way to deploy common tasks like this via Fauna Schema Migrate using ESM imports - would this approach work for you? Note that this would still involve creating and calling UDFs.
Any current update on native geospatial support with fauna? It seems strange to not have this on the roadmap as fauna seems to be perfectly positioned as being a one stop shop for everyone’s db needs
Indeed we do want to the best, general purpose database available. Support for geohashes, and more broadly geospatial query patterns, is not yet on our immediate roadmap. However it is something we’re interested in supporting in the future. This could include the ability to define points, lines, and polygons and use these geometric elements in your queries.
For instance, you could define a polygon representing a specific geographic area, or zone, and query you collection for documents that have latitude and longitude coordinate that fall within that zone. Would such a capability suit your use case @cntran, @pier, or @friso?
Hi Bryan, yes that sort of support would be great. A simple ability to be able to insert a specific GeoPoint data type and then just to be able to query records that are within a designated polygon or within a specific radius of a geopoint would be sufficient imo.
You did mention it’s not in the immediate roadmap but any idea on how far out something like this would be? I have been hesitant to switch a few mongodb related projects to fauna because of this. Thanks!
Thanks for your interest here folks. I am going to close this request since GeoHashes are not on the current roadmap. We’ll continue to watch for interest in this feature.