Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for serializing/deserializing geometry to geohash? #213

Open
JimBlaney opened this issue Jan 28, 2019 · 3 comments
Open

Support for serializing/deserializing geometry to geohash? #213

JimBlaney opened this issue Jan 28, 2019 · 3 comments

Comments

@JimBlaney
Copy link

I'm looking to see if implementing Geometry <-> Geohash functionality would be something that would be welcomed for inclusion in this library. I know there are other Java libraries to do Geohashing, but looking for something that explicitly constructs a java.com.esri.core.geometry.Geometry instance. Thanks!

@stolstov
Copy link
Member

@JimBlaney What types of geometry would you convert to and from geohash?

@JimBlaney
Copy link
Author

My particular use case includes:

  • point -> geohash
  • geohash -> envelope
  • geohash -> point (centroid)

@stolstov
Copy link
Member

stolstov commented Aug 6, 2019

Preferably this should be a standalone Geohash class.
class Geohash:
static Envelope2D geohashToEnvelope(String geoHash) - envelope of the geohash cell.
static String toGeohash(Point2D pt, int characterLength) - converts a point to the geohash of given length. Other direction of conversion is to use geohashToEnvelope and get the envelope center.
static String containingGeohash(Envelope2D envelope) - longest geohash that contains the envelope
static String[] coveringGeohash(Envelope2D envelope) - up to four geohashes that completely cover given envelope.

muchembledMartin added a commit to DD2480-Group-3/geometry-api-java that referenced this issue Mar 2, 2024
muchembledMartin added a commit to DD2480-Group-3/geometry-api-java that referenced this issue Mar 2, 2024
muchembledMartin added a commit to DD2480-Group-3/geometry-api-java that referenced this issue Mar 2, 2024
muchembledMartin added a commit to DD2480-Group-3/geometry-api-java that referenced this issue Mar 2, 2024
muchembledMartin added a commit to DD2480-Group-3/geometry-api-java that referenced this issue Mar 3, 2024
WenJJ2000 added a commit to DD2480-Group-3/geometry-api-java that referenced this issue Mar 4, 2024
commit b29091a
Merge: 9b64610 9aaaf4c
Author: Wen Jun Jie <132931864+WenJJ2000@users.noreply.github.com>
Date:   Mon Mar 4 10:09:16 2024 +0100

    Merge pull request #55 from DD2480-Group-3/54-coveringGeohash

    54 covering geohash

commit 9aaaf4c
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 10:00:46 2024 +0100

    Squashed commit of the following:

    commit 279212f
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Mon Mar 4 09:46:08 2024 +0100

        fix: solves bug where precision is allowed to be too high

        Limits the precision in containingGeohash function to 6 from 24
        since the toGeohash function has been updated to only work for
        highest precision 6.

    commit 2aa650f
    Merge: 263f8e2 dcdb58d
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Mon Mar 4 09:45:04 2024 +0100

        Merge branch '213-geometry-to-geohash' of github.com:DD2480-Group-3/geometry-api-java into 54-coveringGeohash

    commit 263f8e2
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:47:34 2024 +0100

        refactor: removed missed empty line

    commit 72b84f4
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:47:05 2024 +0100

        refactor: removed empty line

    commit 6fef312
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:45:34 2024 +0100

        refactor: removed empty lines

    commit 1287b2c
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:39:49 2024 +0100

        test: changed envelope to encompass 4 different parts of the geo grid

        The envelope was previously assigned wrong max x and y values, which
        resulted in errors as the coveringGeohash function didn't return
        the expected amount of geo hashes.

    commit 69ca9c0
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:30:38 2024 +0100

        fix: solves bug which resulted in wrong geohashes

    commit 2a8d131
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:24:32 2024 +0100

        test: updated tests to match the changes of the function in last commit

    commit bb45871
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:24:02 2024 +0100

        refactor: made the return string array dynamic

    commit 708542e
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:42:15 2024 +0100

        refactor: removes indentation error caused by merge

    commit a216691
    Merge: 4420765 62f7d5f
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:41:36 2024 +0100

        Merge branch '213-geometry-to-geohash' of github.com:DD2480-Group-3/geometry-api-java into 54-coveringGeohash

    commit 4420765
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:37:30 2024 +0100

        test: added test cases for coveringGeohash function

    commit 2c31979
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:15:40 2024 +0100

        refactor: removes unnecessary if statement

        Removes if statement which didn't change the outcome of the program.

    commit e0b04d3
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 17:39:37 2024 +0100

        feat: coveringGeohash funciton added

        Adds funtion which given an envelope returns up to four geohashes
        which cover the envelope.

commit 9b64610
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 09:24:34 2024 +0100

    docs : update doucmentation for helper function and removed commented code

commit dcdb58d
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 07:52:31 2024 +0100

    refactor : Changed toGeoHash function to use bitwise operations instead of strings to improve time complexity

commit 80aa932
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 00:33:36 2024 +0100

    refactor : changing helper functions to private instead of public and removing their tests

commit 62f7d5f
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:48:48 2024 +0100

    Test: added some tests for containingGeohash

commit 7191907
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:47:58 2024 +0100

    Fix: lat and lon were inverted in test for toGeohash

commit b21e5b9
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:45:28 2024 +0100

    Feat: Implemented containingGeohash

commit c30e1e5
Merge: 84ef58e dbe750f
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:44:34 2024 +0100

    Fix: lat and lon were inverted in tooGeoHash

commit 84ef58e
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 11:02:32 2024 +0100

    test: Added some tests for toGeohash Esri#213

commit dbe750f
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Sun Mar 3 00:21:25 2024 +0100

    tests : added test for TestToGeoHash

commit e4adae4
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Sat Mar 2 23:32:43 2024 +0100

    tests : added test for binaryToBase32 and TestCovertToBinary

commit 42b5287
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Sat Mar 2 23:14:06 2024 +0100

    feat : Added toGeoHash function with 2 helper function BinaryToBase32 and converyTobinary

commit 5fd7cb0
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 17:33:31 2024 +0100

    Feat: Implemented geohashToEnvelope Esri#213

commit cac7dfd
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 17:30:08 2024 +0100

    test: added some tests for geohashToEnvelope Esri#213

commit 8461a3c
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 16:15:02 2024 +0100

    Test: Created a test file for geohash Esri#213

commit af667b6
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 14:45:05 2024 +0100

    Feat: Created Geohash class and its skeletton Esri#213
WenJJ2000 added a commit to DD2480-Group-3/geometry-api-java-213 that referenced this issue Mar 4, 2024
* docs: Added md file that describes the tags for our commits

COMMIT.md contains the structure for how we should add tags to our
commits to make them easier to understand.

* Revert "docs: Added md file that describes the tags for our commits"

* Squashed commit of the following:

commit b29091a
Merge: 9b64610 9aaaf4c
Author: Wen Jun Jie <132931864+WenJJ2000@users.noreply.github.com>
Date:   Mon Mar 4 10:09:16 2024 +0100

    Merge pull request Esri#55 from DD2480-Group-3/54-coveringGeohash

    54 covering geohash

commit 9aaaf4c
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 10:00:46 2024 +0100

    Squashed commit of the following:

    commit 279212f
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Mon Mar 4 09:46:08 2024 +0100

        fix: solves bug where precision is allowed to be too high

        Limits the precision in containingGeohash function to 6 from 24
        since the toGeohash function has been updated to only work for
        highest precision 6.

    commit 2aa650f
    Merge: 263f8e2 dcdb58d
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Mon Mar 4 09:45:04 2024 +0100

        Merge branch '213-geometry-to-geohash' of github.com:DD2480-Group-3/geometry-api-java into 54-coveringGeohash

    commit 263f8e2
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:47:34 2024 +0100

        refactor: removed missed empty line

    commit 72b84f4
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:47:05 2024 +0100

        refactor: removed empty line

    commit 6fef312
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:45:34 2024 +0100

        refactor: removed empty lines

    commit 1287b2c
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:39:49 2024 +0100

        test: changed envelope to encompass 4 different parts of the geo grid

        The envelope was previously assigned wrong max x and y values, which
        resulted in errors as the coveringGeohash function didn't return
        the expected amount of geo hashes.

    commit 69ca9c0
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:30:38 2024 +0100

        fix: solves bug which resulted in wrong geohashes

    commit 2a8d131
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:24:32 2024 +0100

        test: updated tests to match the changes of the function in last commit

    commit bb45871
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 19:24:02 2024 +0100

        refactor: made the return string array dynamic

    commit 708542e
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:42:15 2024 +0100

        refactor: removes indentation error caused by merge

    commit a216691
    Merge: 4420765 62f7d5f
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:41:36 2024 +0100

        Merge branch '213-geometry-to-geohash' of github.com:DD2480-Group-3/geometry-api-java into 54-coveringGeohash

    commit 4420765
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:37:30 2024 +0100

        test: added test cases for coveringGeohash function

    commit 2c31979
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 18:15:40 2024 +0100

        refactor: removes unnecessary if statement

        Removes if statement which didn't change the outcome of the program.

    commit e0b04d3
    Author: Linus Wallin <linuswallin@live.se>
    Date:   Sun Mar 3 17:39:37 2024 +0100

        feat: coveringGeohash funciton added

        Adds funtion which given an envelope returns up to four geohashes
        which cover the envelope.

commit 9b64610
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 09:24:34 2024 +0100

    docs : update doucmentation for helper function and removed commented code

commit dcdb58d
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 07:52:31 2024 +0100

    refactor : Changed toGeoHash function to use bitwise operations instead of strings to improve time complexity

commit 80aa932
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Mon Mar 4 00:33:36 2024 +0100

    refactor : changing helper functions to private instead of public and removing their tests

commit 62f7d5f
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:48:48 2024 +0100

    Test: added some tests for containingGeohash

commit 7191907
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:47:58 2024 +0100

    Fix: lat and lon were inverted in test for toGeohash

commit b21e5b9
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:45:28 2024 +0100

    Feat: Implemented containingGeohash

commit c30e1e5
Merge: 84ef58e dbe750f
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 16:44:34 2024 +0100

    Fix: lat and lon were inverted in tooGeoHash

commit 84ef58e
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sun Mar 3 11:02:32 2024 +0100

    test: Added some tests for toGeohash Esri#213

commit dbe750f
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Sun Mar 3 00:21:25 2024 +0100

    tests : added test for TestToGeoHash

commit e4adae4
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Sat Mar 2 23:32:43 2024 +0100

    tests : added test for binaryToBase32 and TestCovertToBinary

commit 42b5287
Author: wenjj2000 <wenjj2000@gmail.com>
Date:   Sat Mar 2 23:14:06 2024 +0100

    feat : Added toGeoHash function with 2 helper function BinaryToBase32 and converyTobinary

commit 5fd7cb0
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 17:33:31 2024 +0100

    Feat: Implemented geohashToEnvelope Esri#213

commit cac7dfd
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 17:30:08 2024 +0100

    test: added some tests for geohashToEnvelope Esri#213

commit 8461a3c
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 16:15:02 2024 +0100

    Test: Created a test file for geohash Esri#213

commit af667b6
Author: --replace-all <muchembled.martin@gmail.com>
Date:   Sat Mar 2 14:45:05 2024 +0100

    Feat: Created Geohash class and its skeletton Esri#213

* Docs : added GeoHash patch file

---------

Co-authored-by: karlsb <36365664+karlsb@users.noreply.github.com>
Co-authored-by: wenjj2000 <wenjj2000@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants