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

feat: Add download_all_layers function #380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

popogis24
Copy link

Add download_all_layers function

This PR adds a new function that allows users to download all available geobr layers at once.

Features

  • New download_all_layers function that downloads all available layers using their default years
  • Support for two output formats:
    • GeoJSON (default)
    • GPKG (GeoPackage)
  • Configurable output folder (defaults to 'geobr_layers')
  • Proper error handling and driver validation
  • Comprehensive test coverage

Example Usage

from geobr import download_all_layers

Download all layers in GeoJSON format (default)
download_all_layers()

Download all layers in GeoPackage format
download_all_layers(driver="GPKG")

Download to a custom folder
download_all_layers(output_folder="my_layers")

- Add new function to download all available geobr layers at once
- Support GeoJSON (default) and GPKG output formats
- Add comprehensive tests for the new functionality
- Implement proper error handling for invalid drivers
@rafapereirabr
Copy link
Member

Thanks for the PR, @popogis24 . I'm not sure, though, this is function we should have. What exactly is the use case here ?

@popogis24
Copy link
Author

popogis24 commented Mar 7, 2025

The main use case for this function is to streamline the process of downloading all available geobr layers in a single step, ensuring users have a local copy of the complete dataset without needing to call multiple functions manually.
This is particularly useful for applications that require offline access to geospatial data or for batch processing workflows where multiple layers are needed at once.

For example, I have a system that requires a spatial database to be always up to date, and this function would help me ensure that the latest data is downloaded automatically, without needing to do it manually.

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