Geohashes in FaunaDB

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).

MongoDB also has built-in geospatial types and queries.

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 :upside_down_face:

1 Like


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.

1 Like