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

display the bounds of an asset as a reprojected polygon #38

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

DanielJDufour
Copy link
Member

@DanielJDufour DanielJDufour commented Jun 6, 2022

Currently when a user passes a STAC asset that is a COG to stacLayer, the code will:

  • fetch and parse the COG metadata
  • compute the bounding box of the COG from the xmin, xmax, ymin, and ymax georaster properties
  • reproject the [xmin, ymin, xmax, ymax] array-based bounding box to latitude/longitude (4326), keeping the array of 4 numbers format
  • display as a rectangle

The new code replaces the last 2 steps, by:

  • converting the bounding box to a GeoJSON-like Polygon Feature (without reprojection, so it's still in the projection of the raster); and then...
  • reprojecting the polygon to latitude/longitude
  • display as a polygon

Here's a screenshot of the new code in action:
Screen Shot 2022-06-06 at 11 02 10 AM
You can notice that the bounds are slightly slanted, following more closely the bounds of the raster.

note:
It appears that stac-layer doesn't work for the newest release of Leaflet, so we will have to debug that. That is why the Leaflet version is locked to 1.7.1 in the package.json.

Future Work:

  • This work only supports the scenario where an asset is passed to stacLayer, so we still have to address STAC items. I wanted to break this work up into smaller more manageable PRs, so that work will come in another PR.

@DanielJDufour DanielJDufour requested a review from m-mohr June 9, 2022 00:43
Copy link
Collaborator

@m-mohr m-mohr left a comment

Choose a reason for hiding this comment

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

Looks good, I think. Thanks.

@m-mohr m-mohr added this to the 0.12.0 milestone Jun 9, 2022
@DanielJDufour DanielJDufour merged commit 84be005 into main Jun 9, 2022
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