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

Add BBox to Geometries. #108

Merged
merged 2 commits into from
Feb 27, 2023

Conversation

eseglem
Copy link
Collaborator

@eseglem eseglem commented Feb 11, 2023

What I am changing

  • Add BBox to Geometries.

How I did it

  • Add optional bbox to _GeometryBase and GeometryCollection

How you can test it

  • Only one minor tweak to a test. Don't think anything new is needed for the optional field.

Related Issues

  • n/a

I was looking over some CQL2 stuff and got confused when I saw an optional BBox on their Geometries, but technically that is correct.

A GeoJSON object MAY have a member named "bbox" to include information on the coordinate range for its Geometries, Features, or FeatureCollections.

Copy link
Contributor

@geospatial-jeff geospatial-jeff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vincentsarago
Copy link
Member

can I ask you to add a line in the change log before we merge @eseglem 🙏

@vincentsarago vincentsarago merged commit 46c088d into developmentseed:main Feb 27, 2023
@marquesine
Copy link

Hi, I'm currently using the geojson_pydantic library (v. 0.6.1) with FastAPI. I appreciate the ready-made Pydantic models for GeoJSON. Thank you for your work on this.

I noticed that when I call some_polygon.dict(), the output includes a bbox attribute even though bounding boxes are optional in the GeoJSON specification. This happens even if the bounding box has not been calculated or set.

For instance:

>>> polygon = geojson_pydantic.Polygon(type="Polygon", coordinates=[[(0, 0), (0, 1), (1, 0), (0, 0)]])
>>> polygon.dict()
{'type': 'Polygon', 'coordinates': [[(0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (0.0, 0.0)]], 'bbox': None}

@eseglem eseglem deleted the feature/add-bbox-to-geoms branch May 12, 2023 22:36
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

Successfully merging this pull request may close these issues.

4 participants