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

feat: adds features module with 2D spatial index and basic property utils #27

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

edparris
Copy link
Contributor

This change adds a new aws.osml.features module that will contain classes and functions designed to work with features derived from overhead imagery. As a start two classes have been added:

  • ImagedFeaturePropertyAccessor: This class abstracts away the different GeoJSON property names various projects have been using (e.g. "bounds_imcoords", "geom_imcoords", "detection.pixelCoordinates", etc.) and provides a consistent interface for reading and writing those properties. This is a first step towards the proposed standard of "imageGeometry" and "imageBBox" properties.
  • STRFeature2DSpatialIndex: This class is a 2D spatial index of GeoJSON features that will allow us to efficiently find features using spatial queries or nearest neighbor searches. The current implementation is based on a Sort-Tile-Recursive (STR) tree implemented by Shapely but a general Feature2DSpatialIndex abstraction has been provided allowing us to swap out implementations in the future.

This change does add a new dependency on the Shapely library to supply the geometry primitives used in this library. Shapely is already used by the OSML ModelRunner so this addition will not increase the overall dependency footprint.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@edparris edparris marked this pull request as ready for review November 14, 2023 23:18
DETECTION = "detection"
TYPE = "type"
COORDINATES = "coordinates"
PIXEL_COORDINATES = "pixelCoordinates"
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we have a mix of camelCase and snake_case values - would we be able to standardize on one of them or is this driven by an external interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are driven by external interfaces.

I agree it would be best to pick one convention and stick with it. At some point we may want to release a breaking change to remove the older values.

@edparris edparris merged commit e821899 into dev Nov 16, 2023
1 check passed
@edparris edparris deleted the feature/tiled-feature-collection branch November 16, 2023 00:28
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.

2 participants