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

CEP data #230

Open
JoaoCarabetta opened this issue Mar 31, 2021 · 0 comments
Open

CEP data #230

JoaoCarabetta opened this issue Mar 31, 2021 · 0 comments
Assignees
Labels
new Data request Request to include data sets in the package

Comments

@JoaoCarabetta
Copy link
Collaborator

Following up our conversation about adding CEP data to geobr.

The current idea is to map CEP numbers to h3 hexagons, so that each hexagon would have a list of CEPs.

API

get_cep_by_geo(latitude, longitude, h3_id)
"""
Gets H3 hexagon in that maps to the coordinates and returns a list of CEP numbers.

The user can use lat, lon or the h3_id to get the CEP numbers

Return
-------
Dataframe:
     h3_id
     h3_geometry
     cep_number
"""

get_geo_by_cep(cep_number)
"""
Gets all H3 hexagons that contains the CEP number. 

Return
-------
Dataframe:
      h3_id
      h3_geometry
      cep_number

Infrastructure

get_cep_by_geo
  1. Map latitude, longitude to h3 cell using the H3 package that is available for python and R.
  2. Get the selected h3 cell parents
  3. Search a file system with the following structure:
    - h3_cell_resolution_4_id
    - h3_cell_resolution_5_id
    - h3_cell_resolution_6_id
    - ... up to a convenient resolution
    On a reasonable resolution, we should save a dataframe that is small enough to be downloaded and filtered.
  4. Download df, filter by h3 cell id and return
get_geo_by_cep
  1. Search a file system with the following structure:
    - first CEP digit
    - second CEP digit
    - third CEP digit
    - ....
    On a reasonable CEP digit, we should save a dataframe that is small enough to be downloaded and filtered.
  2. Download df, filter by h3 cell id and return

@rafapereirabr let me know what you think. It is not easy to build those indexes, but I it would be incredible to have it!

@JoaoCarabetta JoaoCarabetta added the new Data request Request to include data sets in the package label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new Data request Request to include data sets in the package
Projects
None yet
Development

No branches or pull requests

2 participants