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

Use shapes for DTM coverage #169

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Use shapes for DTM coverage #169

wants to merge 8 commits into from

Conversation

kbrandwijk
Copy link
Collaborator

  • generate_extents.py script in the dev folder generates a combined shapes file with all the bounds for all the providers. When a new provider is added, it will need to be added to that script to include the bounds in the generated shapes file.

  • the _extents properties are removed, instead there's an _extent_identifier which points to the name of the dataset in the shapes file for the provider (this was easier than renaming them all in the generate script, although technically we could)

  • the valid_providers method (the existing one) now also takes the size because we want to make sure the entire bounding box is inside the extents of the selected provider. That method now uses the generated shapes file to determine if a provider should be filtered or not. Providers that have not been added to the script/shapes file will always be returned.

image

@kbrandwijk kbrandwijk requested a review from iwatkot January 21, 2025 23:33
@kbrandwijk kbrandwijk added DTM Provider Adds new or edits existing DTM provider. Refactoring Nothing fancy, just sweat and blood. labels Jan 21, 2025
combined = pandas.concat([states, countries])

# handling by name (for most of them)
names = [
Copy link
Owner

Choose a reason for hiding this comment

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

Can we automatically retrieve this list somewhere? Providers?
Why it's hardcoded?

Copy link
Owner

Choose a reason for hiding this comment

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

Like iterating over the DTM Provider subclasses and parse their names or something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well they are not all treated the same so if we want to iterate over the providers automatically, then how do we treat some differently (like England, Scotland and the others in there)

Copy link
Owner

Choose a reason for hiding this comment

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

@kbrandwijk, can't we somehow make it in a universal way? So we don't need some weird list of strings and so on, just hit F5 and we're ready to go?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately not. Some providers don't match 1-on-1 with a country, so some need special handling.

Copy link
Owner

Choose a reason for hiding this comment

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

@kbrandwijk, can we implement somehow this special handling as a property or a method of a DTM Provider class?

The thing is: when I'm looking here I see a big red text: no one will evar be able to implement their own DTM Provider unless they developed this feature with extent. 🤣
And that worries me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That'd be nice actually to move this to the provider classes. I can just iterate over provider subclasses like we already do, and if there's a method defined to extract the data, we use it, otherwise we do it by name.

dev/ne_10m_admin_1_states_provinces.zip Outdated Show resolved Hide resolved
maps4fs/generator/dtm/czech.py Show resolved Hide resolved
dev/ne_50m_admin_0_countries.zip Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DTM Provider Adds new or edits existing DTM provider. Refactoring Nothing fancy, just sweat and blood.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants