Skip to content
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

Implement calculateBoundingBox() method for GeoJsonObjects. #45

Open
zerobandwidth opened this issue Jan 4, 2018 · 0 comments
Open

Comments

@zerobandwidth
Copy link

Add a calculateBoundingBox() method to GeoJsonObject, which would calculate (and reset) the object's bbox based on the instance's other attributes.

Class Suggested Implementation
GeoJsonObject Define it as abstract to force implementation classes to provide it.
Feature Call this.getGeometry().calculateBoundingBox().
FeatureCollection Get the box for each Feature in the collection, then draw a box around all results.
Geometry Leave it abstract.
LineString Might get away with using MultiPoint's implementation?
MultiLineString Calculate min/max lat/long among all line endpoints.
MultiPoint Calculate the min/max lat/long from all points.
MultiPolygon Get the box for each Polygon, then draw a box around all of those boxes.
Point Set a "box" at the point's coordinates.
Polygon Calculate the min/max lat/long from all points on the outermost ring.

The order of the four double values must correspond to the order assumed in the definition of the bbox member of GeoJsonObject (whatever that is).

Consider calling this method automatically in any method that alters the shape of the object, such that the bounding box is updated in real 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

No branches or pull requests

1 participant