anovis / proximity_hash

Proximity Hash generates a set of geohashes that cover a circular area, given the center coordinates and the radius.
https://pub.dev/packages/proximity_hash
Apache License 2.0
5 stars 0 forks source link

This package vs geoflutterfire and others #7

Closed giorgio79 closed 3 years ago

giorgio79 commented 3 years ago

Hello,

How does this package compare with https://pub.dev/packages/geoflutterfire ?

Or https://pub.dev/packages/geo_firestore_flutter https://pub.dev/packages/geofire_flutter

anovis commented 3 years ago

i have not used those packages, but from what I can tell geofire flutter is a wrapper around firestore to help store and query your geolocation data. if you need a database solution for geolocation data then that wrapper along with firestore makes it easy to save and query coordinates..

however, if you do not want to use firestore or want to handle queries on device then you will need to implement your own solution which proximity_hash can help with. In this case you will want to store your geolocation coordinates in geohashes and then use proximity_hash to quickly search and return coordinates within a certain boundary.

I have made an additional library https://pub.dev/packages/geohashtree that helps with the geohash conversions and queries by grouping geohashes in a tree format automatically and allowing queries using this proximity_hash library.

giorgio79 commented 3 years ago

Thank you! Interesting. Could you post a db structure perhaps?

I am trying to picture scaling this method. If one stores the city, it would be enough to retrieve those items to the client instead of returning he whole world?

anovis commented 3 years ago

sure. there are a lot of ways you can store and query this type of data so it may be helpful to learn a little more about your use case.

I can certainly start by telling you how I am going about it for one of my projects. Essentially I am storing items based on city (could be state or country depending on data size) on a backend db. when I get a users location I query the backend db for the data and then cache on device in a geohash tree. then based on the users location I use proximity hash, which is built into the geohash tree to get all items in the tree within a radius from the user or a desired location. this is usually a quick lookup as it is essentially a nested dictionary lookup using the proximity hashes.