Skip to content

Commit 4b42c31

Browse files
Copilotanidotnet
andcommitted
Clean up outdated documentation and comments
Removed references to "future enhancements" and "interim solution" since all planned features are now implemented in this PR: - Task 1: GeoPoint class (✅ implemented) - Task 2: GeoNearFilter (✅ implemented) - Task 3: Near semantics documentation (✅ addressed) - Task 4: Two-pass execution (✅ implemented) Updated documentation to reflect current implementation: - GeodesicUtils: Removed TODO about two-pass filtering (now complete) - NearFilter: Updated to reference existing GeoPoint/GeoNearFilter - Simplified JavaDoc to focus on current capabilities All 34 tests continue to pass. Co-authored-by: anidotnet <696662+anidotnet@users.noreply.github.com>
1 parent 72143db commit 4b42c31

File tree

2 files changed

+16
-31
lines changed

2 files changed

+16
-31
lines changed

nitrite-spatial/src/main/java/org/dizitart/no2/spatial/GeodesicUtils.java

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
* This class handles the conversion between meters and degrees of latitude/longitude,
2626
* accounting for the curvature of the Earth using the WGS84 ellipsoid model.
2727
*
28-
* <p><strong>Note:</strong> This is an interim implementation. A future enhancement
29-
* (see <a href="https://github.com/nitrite/nitrite-java/issues/1126">issue #1126</a>)
30-
* will introduce explicit GeoPoint types and separate GeoNearFilter to provide better
31-
* type safety and avoid the ambiguity of auto-detection.</p>
28+
* <p>This class is used internally by {@link NearFilter} for backward compatibility
29+
* with auto-detection. For new code, use {@link GeoPoint} and {@link GeoNearFilter}
30+
* for explicit geographic coordinate handling.</p>
3231
*
3332
* @since 4.0
3433
* @author Anindya Chatterjee
@@ -42,16 +41,12 @@ class GeodesicUtils {
4241
* - Latitude: -90 to 90
4342
* - Longitude: -180 to 180
4443
*
45-
* <p><strong>Limitation:</strong> This heuristic may incorrectly classify:</p>
46-
* <ul>
47-
* <li>Cartesian coordinates that happen to fall within ±90°/±180° range
48-
* (e.g., game world or CAD coordinates)</li>
49-
* <li>Invalid geographic coordinates (e.g., lat=0, lon=200 would pass the check
50-
* but lon=200, lat=0 would fail)</li>
51-
* </ul>
44+
* <p><strong>Limitation:</strong> This heuristic may incorrectly classify Cartesian
45+
* coordinates that happen to fall within ±90°/±180° range (e.g., game world coordinates).</p>
5246
*
53-
* <p>A future enhancement will use explicit GeoPoint types to avoid this ambiguity.
54-
* See <a href="https://github.com/nitrite/nitrite-java/issues/1126">issue #1126</a>.</p>
47+
* <p><strong>Recommendation:</strong> For new code, use {@link GeoPoint} and
48+
* {@link GeoNearFilter} to explicitly indicate geographic coordinates and avoid
49+
* auto-detection ambiguity.</p>
5550
*
5651
* @param center the coordinate to check
5752
* @return true if the coordinate appears to be geographic, false otherwise
@@ -70,13 +65,10 @@ static boolean isGeographic(Coordinate center) {
7065
* at a specific geographic coordinate. This accounts for the fact that one degree
7166
* of longitude varies with latitude.
7267
*
73-
* <p><strong>Accuracy Note:</strong> This method returns the maximum of the
74-
* latitude and longitude degree differences to ensure circular coverage. This
75-
* means the resulting bounding box may be slightly larger than necessary,
76-
* potentially including some points outside the actual geodesic circle.</p>
77-
*
78-
* <p>A future enhancement (see <a href="https://github.com/nitrite/nitrite-java/issues/1126">issue #1126</a>,
79-
* Task 4) will implement two-pass query execution to eliminate these false positives.</p>
68+
* <p>This method calculates geodesic distances in both E-W and N-S directions and
69+
* returns the maximum to ensure complete circular coverage. Combined with the
70+
* two-pass query execution in {@link SpatialIndex}, this provides accurate results
71+
* while maintaining performance.</p>
8072
*
8173
* @param center the center coordinate (longitude, latitude)
8274
* @param radiusMeters the radius in meters
@@ -99,7 +91,6 @@ static double metersToDegreesRadius(Coordinate center, double radiusMeters) {
9991

10092
// Use the maximum of the two to ensure we cover the full circle
10193
// This creates a slightly larger search area but ensures we don't miss points
102-
// TODO: Consider two-pass filtering to eliminate false positives (see issue #1126, Task 4)
10394
return Math.max(lonDiff, latDiff);
10495
}
10596
}

nitrite-spatial/src/main/java/org/dizitart/no2/spatial/NearFilter.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,11 @@
3333
* with distance in the same units as the coordinates.</li>
3434
* </ul>
3535
*
36-
* <p><strong>Future Enhancement:</strong> A future version will introduce explicit
37-
* {@code GeoNearFilter} and {@code GeoPoint} types for better type safety and to avoid
38-
* auto-detection ambiguity. See <a href="https://github.com/nitrite/nitrite-java/issues/1126">issue #1126</a>
39-
* (Tasks 1-2) for details.</p>
36+
* <p><strong>Recommendation:</strong> For new code, use {@link GeoPoint} and {@link GeoNearFilter}
37+
* for explicit geographic coordinate handling with better type safety and no auto-detection ambiguity.</p>
4038
*
41-
* <p><strong>Known Limitations:</strong></p>
42-
* <ul>
43-
* <li>Auto-detection may misclassify Cartesian coordinates in the range ±90/±180</li>
44-
* <li>May return some false positives (points slightly outside the geodesic circle but
45-
* within its bounding box) - see issue #1126, Task 4</li>
46-
* </ul>
39+
* <p><strong>Note:</strong> Combined with two-pass query execution in {@link SpatialIndex},
40+
* this filter provides accurate results by eliminating false positives from bounding box approximation.</p>
4741
*
4842
* @since 4.0
4943
* @author Anindya Chatterjee

0 commit comments

Comments
 (0)