Skip to content

Merging latest from golang/geo into blevesearch/geo #24

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

Merged
merged 52 commits into from
Apr 17, 2025

Conversation

abhinavdangeti
Copy link
Member

@abhinavdangeti abhinavdangeti commented Apr 16, 2025

* 7807d88 Abhinav Dangeti | Add github workflows
* f0977fe Abhinav Dangeti | Reroute golang/geo imports to blevesearch/geo
*   d718384 Abhi Dangeti | Merge branch 'master' into golang_master
|\  
| * 6c403ec Abhi Dangeti | Upgrade to [email protected] (#17)
| * d029aee Abhi Dangeti | Move up to [email protected] (#16)
| * e7a63fe Abhi Dangeti | MB-54131: Corner cases when buffer not setup & formatting (#15)
| * 045f1ed Likith B | MB-54131: Geoshape query decode optimization (#14)
| * 7135870 Abhi Dangeti | Update GO version (#13)
| * c261b53 Abhi Dangeti | Upgrade to [email protected] (#12)
| * 7bbb772 Abhi Dangeti | Upgrade to [email protected] (#11)
| * a8f4556 Aditi Ahuja | Updated intersection logic (#10)
| * 256c704 Aditi Ahuja | Added disjoint relation (#8)
| * 1bc1d50 Aditi Ahuja | Fix for linestrings enclosed by polygon (#9)
| * 6c4acc9 Abhi Dangeti | Set bleve/bleve_index_api to v1.0.3 (#7)
| * c569765 Sreekanth Sivasankaran | Adding Value() ([]byte, error) method (#6)
| *   aab42ad Sreekanth Sivasankaran | Merge pull request #5 from blevesearch/vertex_linestring_fix
| |\  
| | * c1e383d Sreekanth Sivasankaran | Fix for Polygon-LineString containment
| |/  
| *   e435177 Sreekanth Sivasankaran | Merge pull request #4 from blevesearch/jsoniter_version
| |\  
| | * c8c7ced Sreekanth Sivasankaran | Reverting to a stable jsoniter version
| * | 1e74e8d Sreekanth Sivasankaran | Merge pull request #3 from blevesearch/polygon_hole_fix
| |\| 
| | * fa50322 Sreekanth Sivasankaran | Include the polygon vertices for WithIn query
| |/  
| *   4ff549e Sreekanth Sivasankaran | Merge pull request #2 from blevesearch/linestring_fix
| |\  
| | * d9ebb09 Sreekanth Sivasankaran | Updating LineString for multiple points.
| |/  
| *   0850958 Sreekanth Sivasankaran | Merge pull request #1 from blevesearch/s2_encode_decode
| |\  
| | * 4b50f5f Sreekanth Sivasankaran | Introduce Serialisation method for the geo shapes.
| |/  
| * 2b95922 Sreekanth Sivasankaran | Fix hasCrossingRelation() method
| * 5734244 Sreekanth Sivasankaran | updating repo name in go.mod
| * 2e12926 Sreekanth Sivasankaran | updating readme
| * f95441b Sreekanth Sivasankaran | adding region term indexer unit tests
| * 1daa5fa Sreekanth Sivasankaran | Introduce new APIs,
| * 187b978 Sreekanth Sivasankaran | adding commentary for region term indexing Options
| * 37c8f96 Sreekanth Sivasankaran | adding more commentary and utility functions
| * 0a702af Sreekanth Sivasankaran | Introducing CapFromCenterAndRadius api
| * ecc18e7 Sreekanth Sivasankaran | updating the go.mod files
| * 2112278 Sreekanth Sivasankaran | Update rect.go
| * 761d9da Sreekanth Sivasankaran | Update go.mod
| * c9f6529 Sreekanth Sivasankaran | cb build errors
| * c7de933 Sreekanth Sivasankaran | temp fix for marker terms
| * c708aa2 Sreekanth Sivasankaran | adding setter methods for points only and space optimisation
* | ce8b781 Robert Snedegar | Add golangci-lint Github Action formatter and lint checks (#140)
* | b0c6031 Robert Snedegar | Add the OSSF and other action badges to the top of the README (#149)
* | 97e19c1 Jesse Rosenstock | CellID.AllNeighbors: Return nil for invalid level (#146)
* | 9ff7231 Jesse Rosenstock | Run gofmt -s (#148)
* | 1bf973d Jesse Rosenstock | tests: Remove outdated flaky test comments (#147)
* | 07d601f Robert Snedegar | Create scorecard.yml for OSSF (#143)
* | b4895f7 Robert Snedegar | Fix some small issues that were flagged by upcoming lint checks. (#138)
* | b51e350 Pekka Vainio | edge_query: use shapeID instead of index.idForShape lookup (#136)
* | dc45a10 guoguangwu | lexicon: replace loop with values = append(values, ids...) (#102)
* | 7b99cb2 Robert Snedegar | Add methods for testing Points normalizability. (#127)
* | 35ab489 Peter Johnson | edge_distances: fix test (#106)
* | 45267f9 Robert Snedegar | Changes to better support random seeds for flaky tests. (#129)
* | 9f6155a cui fliter | query_options: remove redundant type conversion (#94)
* | b92cf6f Philipp Klose | Replace godoc.org links with pgk.go.dev (#93)
* | 0b6e08c Jonatas Emidio | cell_index_test: Fix typo (#125)
* | f57e2fe Sascha Brawer | metric_test: fix bad error message (#96)
* |   bc23e40 Robert Snedegar | Final two Lax types completing move to public types.
|\ \  
| * | 06402e1 Robert Snedegar | Converting remaining lax types to public.
| * | f404cd9 Robert Snedegar | Converting remaining lax types to public.
| * | 68235aa Robert Snedegar | Rename lax_loop_test_test.go as final step of making laxLoop an official public type.   (Step 1 was lax_loop_test.go -> lax_loop.go with type laxLoop converting to public type LaxLoop.)   (Step 2 was remove lax_loop_test.go to make way for step 3)   (Step 3 lax_loop_test_test.go -> lax_loop_test.go to fit traditional conventions.)
| * | 9eb1fa2 Robert Snedegar | Remove lax_loop_test.go as step two of making laxLoop an official public type.
* | | 824710a Robert Snedegar | Merge pull request #123 from rsned/master
|\| | 
| * | 8e0a9ee Robert Snedegar | Restore check on childPos to no longer test for unreachable negative values. Fix two lint errors.
|/ /  
* | 2bb09a9 Robert Snedegar | Add IJCoordOfEdge, UVCoordOfEdge, CellBoundary and assosciated tests. Update comments in Cell. Migrate IJ and ST methods from Cell to stuv.go to more closely resemble C++ file splits. Add missing tests to stuv.go Add new maxXYZToUVError constant Add more tests for InterpolateDistance. Update comments. Add special case in interpolateFloat64. Add SignDotProd and submethods along with associated tests. Add gappa proof comments to predicates for some of the methods. Fix TestCellDistanceToEdge with updated tolerances to reduce test flakiness. (It is now better but still not zero random edges that fail. Still need more digging to resolve.) Initial internal components of polyline_alignment. Implement VertexAlignment and associated tests for PolylineAlignment Add EdgeRaw, VertexRaw to Cell for the unnormalized variations which are needed for some methods in s2 Predicates. Add SignDotProt and CircleEdgeIntersectionOrdering and associated sub methods and tests. Update textformat to support higher precision printout of values for higher fidelity save/load of values. Update related callers and add test to show the change. Update edge_distance with PointOnRay, PointOnLeft, PointOnRight, PointOnLine and related tests. Added commented parts of several existing tests that needed those. Move epsilon to tests since it's not used in the regular s2 code. Add roundingEpsilon and epsilonForDigits and related tests. Use a constant for sqrt(3) instead of recomputing it many many times.
* | 3c33606 Robert Snedegar | Revise the total precision bits of the big.Floats to be closer to the amounts used in C++ exact_float (from billions down to millions)
* |   438f30b Robert Snedegar | Merge pull request #122 from jmr/deflake
|\ \  
| * | a681026 Jesse Rosenstock | Deflake tests
|/ /  
* |   69a8a98 Robert Snedegar | Merge pull request #117 from jmr/polyline-interp-test
|\ \  
| * | 65bb56d Jesse Rosenstock | TestPolylineInterpolate: Fix unused `want` var
* | |   f13cb10 Robert Snedegar | Merge pull request #118 from jmr/cell-id-from-string
|\ \ \  
| * | | 070ebca Jesse Rosenstock | CellIDFromString: Remove no-op byte < 0 check
| |/ /  
* | | 1e303e5 Robert Snedegar | Update go.yml with correct branch name
* | |   cab189c Robert Snedegar | Merge pull request #119 from jmr/cell-test
|\ \ \  
| * | | 911c8a2 Jesse Rosenstock | s2cell_test: Increase TestCellDistanceToEdge tolerance
| |/ /  
* | |   ed1c8b9 Robert Snedegar | Merge pull request #116 from jmr/shapeutil-test
|\ \ \  
| |/ /  
|/| |   
| * | 3a1f0cb Jesse Rosenstock | TestShapeutilRangeIteratorNext: Test sentinel id
|/ /  
* |   6188549 Robert Snedegar | Merge pull request #114 from jmr/latlng-bm
|\ \  
| * | c5e5a69 Jesse Rosenstock | latlng_test: Add benchmark functions
* | |   2fc3d43 Robert Snedegar | Merge pull request #115 from golang/rsned-patch-1
|\ \ \  
| * | | ae3ea9d Robert Snedegar | Create go.yml
|/ / /  
* / / aa6d65d Robert Snedegar | Add go.sum to match go.mod.
|/ /  
* |   bd601d2 Robert Snedegar | Merge pull request #113 from jmr/comments
|\ \  
| * | 9c70ae5 Jesse Rosenstock | Add and reformat comments
|/ /  
* |   29de3e1 Robert Snedegar | Merge pull request #112 from jmr/update-2025-03-17
|\ \  
| * | 029bad8 Jesse Rosenstock | Export latest google3 version
|/ /  
* | 6adc566 Robert Snedegar | Fix package on s2intersect_test.go
* |   c62752d Robert Snedegar | Merge pull request #101 from rahul2393/master
|\ \  
| * | eee7799 Robert Snedegar | Sync to latest
|/ /  
* / c4acd7a Robert Snedegar | Update go version to support the use of 'any'.q
|/ 

rsned and others added 30 commits April 4, 2023 16:27
Sync in the last couple years of fixes and updates to the extenal repo.
* go.mod: Bump version to 1.21 and add go-cmp dep
* Insert key names into composite literals, where the type is imported from
  another package
* Fix typos
Add some comments that were being stripped.
Add github action to build and test for all pull requests and commits.
latlng_test: Add benchmark functions
TestShapeutilRangeIteratorNext: Test sentinel id
s2cell_test: Increase TestCellDistanceToEdge tolerance
CellIDFromString: Remove no-op byte < 0 check
TestPolylineInterpolate: Fix unused `want` var
Some tests are flaky due to the random seed.  It's not clear whether the
problem is the code or the test.  These all need further investigation.

Just fix the seed for now so that the tests pass.

golang#120
… amounts used in C++ exact_float (from billions down to millions)
Update comments in Cell. Migrate IJ and ST methods from Cell to stuv.go to more closely resemble C++ file splits. Add missing tests to stuv.go
Add new maxXYZToUVError constant
Add more tests for InterpolateDistance. Update comments. Add special case in interpolateFloat64.
Add SignDotProd and submethods along with associated tests. Add gappa proof comments to predicates for some of the methods.
Fix TestCellDistanceToEdge with updated tolerances to reduce test flakiness. (It is now better but still not zero random edges that fail. Still need more digging to resolve.)
Initial internal components of polyline_alignment.
Implement VertexAlignment and associated tests for PolylineAlignment
Add EdgeRaw, VertexRaw to Cell for the unnormalized variations which are needed for some methods in s2 Predicates.
Add SignDotProt and CircleEdgeIntersectionOrdering and associated sub methods and tests.
Update textformat to support higher precision printout of values for higher fidelity save/load of values. Update related callers and add test to show the change.
Update edge_distance with PointOnRay, PointOnLeft, PointOnRight, PointOnLine and related tests. Added commented parts of several existing tests that needed those.
Move epsilon to tests since it's not used in the regular s2 code.
Add roundingEpsilon and epsilonForDigits and related tests.
Use a constant for sqrt(3) instead of recomputing it many many times.
…lic type.

  (Step 1 was lax_loop_test.go -> lax_loop.go with type laxLoop converting to public type LaxLoop.)
  (Step 2 remove lax_loop_test.go to make way for step 3)
  (Step 3 lax_loop_test_test.go -> lax_loop_test.go to fit traditional conventions.)
…ial public type.

  (Step 1 was lax_loop_test.go -> lax_loop.go with type laxLoop converting to public type LaxLoop.)
  (Step 2 was remove lax_loop_test.go to make way for step 3)
  (Step 3 lax_loop_test_test.go -> lax_loop_test.go to fit traditional conventions.)
brawer and others added 19 commits March 28, 2025 07:48
godoc.org will be discontinued and currently redirects to pkg.go.dev.
Add flag (--s2_random_seed) to specify the seed used for random
generation in tests.
Add new testing flag to specify the s2 random seed to allow
repeatability between test runs.
Refactor random test methods to allow optional seeded generators.
Fix up all the functions in s2_test.go to take an optional random
generator.
Change the places that actually generate the random values to test for
the optional parameter and use it if set.
Minor fixes to a couple tests to match the current logic and values in
their corresponding C++ tests. (paddedcell_test to use uniform float vs
random float, fractal test cases relative error size)
Update comments on random seeds to reference current rand form.
With the addition of the random seed flag in testing now, update the
comments on the cases that were triggering flaky tests. If they still
show flakes, the specific cases can now be pushed through to the
underlying random calls.

Fixes golang#120
The fixture for TestEdgeDistancesUpdateMinInteriorDistanceRejectionTestIsConservative
is confusing; it seems to 'want' `false` but actually it is being ignored and the test is expecting `true`.

Use `want` and change the value to `true`.

This agrees with C++:
https://github.com/google/s2geometry/blob/58de4ea1e2f8a294e0c072c602c22232fd1433ad/src/s2/s2edge_distances_test.cc#L204
Add IsNormalizable and EnsureNormalizable and some basic tests for both.
Performance of maybeAddResult is not great since it invokes idForShape twice.

idForShape iterates through all the shapes in shapeIndex to find id for
the shape. If the ShapeIndex contains a big number of shapes it can be
quite a big task to find the id for the shape.

Since shapeID is available for maybeAddResult use it instead of idForShape.
This was created via New Workflow in Actions using the default OSSF
scorecard configuration for now.

---------

Co-authored-by: Alan Strohm <[email protected]>
Remove TODO from tests that are no longer flaky. (Tested 1k times, see
golang#120 (comment))
Return nil if level is too low (cells are too large and might not be
neighbors) or higher than MaxLevel (no such cells exist). Weakens
precondition of function.

golang#104 complained that AllNeighbors
was returning the wrong results, but the level precondition was being
violated. Make this more obvious and less confusing.
This adds a basic configuration that has gofmt and some basic lints
enabled.

staticcheck is currently turned off because there are a number of
outstanding code elements it flagged in the existing code that need to
be fixed up before it should be turned on.

---------

Co-authored-by: Alan Strohm <[email protected]>
@abhinavdangeti abhinavdangeti merged commit df110ce into master Apr 17, 2025
9 checks passed
@abhinavdangeti abhinavdangeti deleted the golang_master branch April 17, 2025 13:53
@panmari
Copy link

panmari commented Apr 25, 2025

Good to see updates making it back to this fork!

I was wondering if you're also interested in bringing some of your improvements upstream. Please comment at golang#134 if you find some time.

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

Successfully merging this pull request may close these issues.