Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) {

@Override
public int transformGeometryToInt(Geometry firstGeometry, Geometry secondGeometry) {
if (GeometryUtils.isGeography(firstGeometry) || GeometryUtils.isGeography(secondGeometry)) {
throw new RuntimeException(String.format("%s is available for Geometry objects only", FUNCTION_NAME));
if (GeometryUtils.isGeography(firstGeometry) != GeometryUtils.isGeography(secondGeometry)) {
throw new RuntimeException("The first and second arguments shall either all be geometry or all geography");
}
// TODO: to fully support Geography contains operation.
return firstGeometry.contains(secondGeometry) ? 1 : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) {

@Override
public int transformGeometryToInt(Geometry firstGeometry, Geometry secondGeometry) {
if (GeometryUtils.isGeography(firstGeometry) || GeometryUtils.isGeography(secondGeometry)) {
throw new RuntimeException(String.format("%s is available for Geometry objects only", FUNCTION_NAME));
if (GeometryUtils.isGeography(firstGeometry) != GeometryUtils.isGeography(secondGeometry)) {
throw new RuntimeException("The first and second arguments shall either all be geometry or all geography");
}
// TODO: to fully support Geography within operation.
return firstGeometry.within(secondGeometry) ? 1 : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ private static Pair<LongSet, LongSet> coverPolygonInH3(Polygon polygon, int reso
} else {
potentialH3Cells.addAll(polyfillCells);
}
potentialH3Cells
.addAll(potentialH3Cells.stream().flatMap(cell -> H3_CORE.kRing(cell, 1).stream()).collect(Collectors.toSet()));
LongSet fullyContainedCell = new LongOpenHashSet(
potentialH3Cells.stream().filter(h3Cell -> polygon.contains(createPolygonFromH3Cell(h3Cell)))
.collect(Collectors.toSet()));
potentialH3Cells
.addAll(potentialH3Cells.stream().flatMap(cell -> H3_CORE.kRing(cell, 1).stream()).collect(Collectors.toSet()));
return Pair.of(fullyContainedCell, potentialH3Cells);
}

Expand Down