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

[DOCS] Fix geometry object creation #484

Merged
merged 5 commits into from
Apr 19, 2023
Merged

Conversation

jsignell
Copy link
Member

@jsignell jsignell commented Apr 17, 2023

Description:

I was running through the docs for #480 and noticed that this one had a minor issue.

PR Checklist:

  • Code is formatted
  • Tests pass
  • Changes are added to the CHANGELOG

@jsignell jsignell changed the title Fix geometry object creation [DOCS] Fix geometry object creation Apr 17, 2023
@jsignell jsignell self-assigned this Apr 17, 2023
@jsignell jsignell added the documentation Improvements or additions to documentation label Apr 17, 2023
@gadomski gadomski self-requested a review April 17, 2023 19:58
@gadomski gadomski added this to the 0.7.0 milestone Apr 17, 2023
@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (b52651d) 87.27% compared to head (dc18155) 87.27%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #484   +/-   ##
=======================================
  Coverage   87.27%   87.27%           
=======================================
  Files          11       11           
  Lines         833      833           
=======================================
  Hits          727      727           
  Misses        106      106           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

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

I got a TypeError when executing this locally:

TypeError                                 Traceback (most recent call last)
Cell In[12], line 2
      1 import pygeoif
----> 2 aoi_as_pygeoif_polygon = pygeoif.geometry.Polygon(aoi_as_dict["coordinates"])
      4 search = client.search(
      5     max_items = 25,
      6     collections = "aster-l1t",
      7     intersects = aoi_as_pygeoif_polygon,
      8 )
     10 print(f"AOI as pygeoif Polygon, found {len(list(search.items()))} items")

File [~/Code/stac-utils/pystac-client/.venv/lib/python3.11/site-packages/pygeoif/geometry.py:535](https://file+.vscode-resource.vscode-cdn.net/Users/gadomski/Code/stac-utils/pystac-client/docs/tutorials/~/Code/stac-utils/pystac-client/.venv/lib/python3.11/site-packages/pygeoif/geometry.py:535), in Polygon.__init__(self, shell, holes)
    533 if holes:
    534     self._interiors = tuple(LinearRing(hole) for hole in holes)
--> 535 self._exterior = LinearRing(shell)

File [~/Code/stac-utils/pystac-client/.venv/lib/python3.11/site-packages/pygeoif/geometry.py:449](https://file+.vscode-resource.vscode-cdn.net/Users/gadomski/Code/stac-utils/pystac-client/docs/tutorials/~/Code/stac-utils/pystac-client/.venv/lib/python3.11/site-packages/pygeoif/geometry.py:449), in LinearRing.__init__(self, coordinates)
    441 def __init__(self, coordinates: LineType) -> None:
    442     """
    443     Initialize a LinearRing.
    444 
   (...)
    447             A sequence of (x, y [,z]) numeric coordinate pairs or triples
    448     """
...
--> 412 point = Point(*coord)
    413 if not point.is_empty:
    414     geoms.append(point)

TypeError: Point.__init__() takes from 3 to 4 positional arguments but 6 were given

I've opened #488 to capture the need to execute our notebooks in CI to ensure they don't bitrot.

@jsignell
Copy link
Member Author

jsignell commented Apr 19, 2023

aoi_as_pygeoif_polygon = pygeoif.geometry.Polygon(aoi_as_dict["coordinates"])

Isn't that the line I changed to aoi_as_pygeoif_polygon = pygeoif.geometry.Polygon(aoi_as_dict["coordinates"][0])?

Because that error that you reported is exactly what I was trying to fix.

@jsignell jsignell requested a review from gadomski April 19, 2023 15:24
Copy link
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

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

🤦🏼 yeah I must have checked out the wrong branch, my bad.

@gadomski gadomski enabled auto-merge (squash) April 19, 2023 15:27
@gadomski gadomski merged commit 3c830a4 into stac-utils:main Apr 19, 2023
@jsignell jsignell deleted the fix-docs branch April 19, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants