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

Allow inheritance #11

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

jtmiclat
Copy link

@jtmiclat jtmiclat commented Jul 5, 2022

Hi, I was facing some issues when trying to extend QuadKey via inheritance. Mainly when I inherited from QuadKey, my methods were not accessible after using some methods like .difference() or .parent().

After looking into it, I figured out that this is because these methods are hardcoded to return a QuadKey instance instead of my own class. I fixed it by replacing QuadKey with self.__class__() or turning the method into a class method and converting QuadKey to cls(...). Let me know what you think and if you have any suggestions for improvements!

@jtmiclat jtmiclat changed the title Allow inheritance by using class method for from_tile, from_geo, and __class__ for QuadKey Allow inheritance Jul 5, 2022
@muety
Copy link
Owner

muety commented Apr 4, 2024

Sorry for only replying after almost 2 years! I let the project slide for quite a while. Thanks for this great contribution anyways!

@muety muety merged commit 7433728 into muety:master Apr 4, 2024
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