kungfoo / geohash-java

Implementation of GeoHashes in java. We try to be/stay compliant to the spec, as far as possible.
Other
981 stars 310 forks source link

Traverse geohashes in a spiral so I can have a cursor #65

Closed waterdrake closed 1 year ago

waterdrake commented 1 year ago

I want to query for a given geohash in a box and then go around it in a spiral, box by box, and query for geohashes in those one by one. The reason I want to do this is so I can save the geohash of a given box and use it as a cursor to continue to look for results from where I left off.

My goal would be to keep track of how many geohashes I found and once I found a certain amount, I would stop and send those results as well as the geohash of the current box as a cursor to the end client.

This is what it would look like visually:

geo1

Is there an established way to do this with this library? I was thinking of using the geoHash.get[northern, southern, etc.]Neighbor() methods to go in a circle one by one.

Any tips would be greatly appreciated. Thank you.

kungfoo commented 1 year ago

You could certainly pull it off with the cardinal directions methods. You'll have to keep track of where on the spiral you are, though.

On Wed, Apr 19, 2023 at 6:32 AM waterdrake @.***> wrote:

I want to query for a given geohash in a box and then go around it in a spiral, box by box, and query for geohashes in those one by one. The reason I want to do this is so I can save the geohash of a given box and use it as a cursor to continue to look for results from where I left off.

My goal would be to keep track of how many geohashes I found and once I found a certain amount, I would stop and send those results as well as the geohash of the current box as a cursor to the end client.

This is what it would look like visually:

[image: geo1] https://user-images.githubusercontent.com/32690998/233047657-8d38533b-c3f4-4281-a93b-9f6ec550d942.png

Is there an established way to do this with this library? I was thinking of using the geoHash.get[northern, southern, etc.]Neighbor() methods to go in a circle one by one.

Any tips would be greatly appreciated. Thank you.

— Reply to this email directly, view it on GitHub https://github.com/kungfoo/geohash-java/issues/65, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAKAKE3QJVF7DTDZODHRXDXB65M7ANCNFSM6AAAAAAXD3WRCM . You are receiving this because you are subscribed to this thread.Message ID: @.***>