zongsizhang commented on code in PR #764:
URL: https://github.com/apache/sedona/pull/764#discussion_r1104396437
##########
common/src/main/java/org/apache/sedona/common/Functions.java:
##########
@@ -543,4 +542,25 @@ public static Geometry split(Geometry input, Geometry
blade) {
// check input geometry
return new GeometrySplitter(GEOMETRY_FACTORY).split(input, blade);
}
+
+
+ /**
+ * get the coordinates of a geometry and transform to Google s2 cell id
+ * @param input Geometry
+ * @param level integer, minimum level of cells covering the geometry
+ * @return List of coordinates
+ */
+ public static Long[] s2CellIDs(Geometry input, int level) {
+ HashSet<S2CellId> cellIds = new HashSet<>();
+ List<Geometry> geoms = GeomUtils.extractGeometryCollection(input);
+ for (Geometry geom : geoms) {
+ try {
+
cellIds.addAll(S2Utils.s2RegionToCellIDs(S2Utils.toS2Region(geom), 1, level,
Integer.MAX_VALUE - 1));
Review Comment:
they are all supported already. MultiPoint, MultiPolygon, MultiLineString
are GeometryCollection, after extraction they become points, polygons and
linestrings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]