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

Vector Zonal Stats: Error when aligning OSM POIs to an Indonesian Regency #70

Closed
Tracked by #42
alronlam opened this issue Jul 4, 2022 · 7 comments · Fixed by #75 or #89
Closed
Tracked by #42

Vector Zonal Stats: Error when aligning OSM POIs to an Indonesian Regency #70

alronlam opened this issue Jul 4, 2022 · 7 comments · Fixed by #75 or #89
Assignees
Labels
bug Something isn't working

Comments

@alronlam
Copy link
Contributor

alronlam commented Jul 4, 2022

Colab notebook for testing:

Scenario:

  • Created an AOI GDF representing the Subang Regency of Indonesia.
  • Tried simply counting the POIs within this area, but got the error seen in the screenshot:

gw_aoi_index_error

gw_aoi_index_error_full_stacktrace

Could it be a typo? Since the key error mentions "GeoWrangleer_aoi_index"

In case it's relevant, noting that the function works when I passed in grid tiles instead of the Subang Regency gdf itself.
gw_aoi_works

@tm-kah-alforja tm-kah-alforja mentioned this issue Jul 4, 2022
12 tasks
@butchtm butchtm added the bug Something isn't working label Jul 4, 2022
@jtmiclat
Copy link
Contributor

jtmiclat commented Jul 4, 2022

This error stems from us not supporting multiindex GeoDataFrames and dissolving generating a multiindex GeoDataFrame

Converting the following

aoi = idn[idn.ADM2_EN == "Subang"].dissolve(by="ADM2_EN")

to

aoi = idn[idn.ADM2_EN == "Subang"]

works.

@jtmiclat
Copy link
Contributor

jtmiclat commented Jul 4, 2022

Alternatively, you can pass as_index as False and this doesn't generate a MultiIndex GeoDataFrame

aoi = idn[idn.ADM2_EN == "Subang"].dissolve(by="ADM2_EN", as_index=False)

@jtmiclat
Copy link
Contributor

jtmiclat commented Jul 4, 2022

@butchtm @alronlam Should we support multiindex geodataframes or should we throw an assertion error telling users that we dont support it?

@butchtm
Copy link
Collaborator

butchtm commented Jul 4, 2022

@jtmiclat @alronlam

For now, we could do a quick fix to throw an assertion error so users are aware we don't support multi-index for now.

Then file an enhancement request to support multi-indexes separately later. cc @tm-kah-alforja

@alronlam
Copy link
Contributor Author

alronlam commented Jul 4, 2022

Ahh I see. Agree with @butchtm I think we can just throw an assertion error for now so it's clear what the error is and how to fix it. I'm not really sure either if multi-index support is something that's necessary.

@jtmiclat
Copy link
Contributor

jtmiclat commented Jul 4, 2022

Alright, i can take this on.

@butchtm
Copy link
Collaborator

butchtm commented Jul 7, 2022

Reopening this. Still reproducible error when I tried today. See this updated gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
3 participants