paleolimbot commented on code in PR #2878: URL: https://github.com/apache/sedona/pull/2878#discussion_r3173518923
########## common/src/main/java/org/apache/sedona/common/geometryObjects/Box2D.java: ########## @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sedona.common.geometryObjects; + +import java.io.Serializable; +import java.util.Objects; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Envelope; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Polygon; + +/** + * Planar 2D bounding box with min/max X and Y. Always a valid finite bbox; absence of a bbox (e.g. + * bbox of an empty geometry, extent over zero rows) is represented by SQL NULL at the column level + * rather than by an in-band sentinel. This matches PostGIS behavior and leaves {@code xmin > xmax} + * free for a future antimeridian-wraparound semantics on geography bboxes (cf. sedona-db's {@code + * WraparoundInterval}). Review Comment: I think you will be happier "allowing" this from the start and erroring when you see `xmin > xmax` anywhere it matters for a computation (e.g., `expandToInclude()`. In other words, the Box2D always allows antimeridian crossing-like behaviour (but not everything has to be implemented yet). I think this will make it easier to avoid accidental incorrect behaviour when those operations do support it. -- 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]
