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

Graph.from_geodataframe(): attribute error for Polygon.id #423

Open
arulandu opened this issue Jun 6, 2024 · 0 comments
Open

Graph.from_geodataframe(): attribute error for Polygon.id #423

arulandu opened this issue Jun 6, 2024 · 0 comments

Comments

@arulandu
Copy link

arulandu commented Jun 6, 2024

I'm working with some dummy county data using geopandas/shapely. Running the following line errors:
graph = Graph.from_geodataframe(guilford_county, adjacency='queen')

File ~/.../python3.12/site-packages/gerrychain/graph/adjacency.py:21, in str_tree(geometries)
     17 """Add ids to geometries and create a STR tree for spatial indexing.
     18 Use this for all spatial operations!
     19 """
     20 for i in geometries.index:
---> 21     geometries[i].id = i
     22 try:
     23     tree = STRtree(geometries)
     ```

AttributeError: 'Polygon' object has no attribute 'id'

It seems like the `id` property on Polygon doesn't exist, but a `uid` does. Is this library out of date?
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