Created
April 19, 2021 21:48
-
-
Save JoaoCarabetta/d45ef052aded84eb043c7ec55a12bf7c to your computer and use it in GitHub Desktop.
Intersect point to hexagon - SQL Base dos Dados
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select id_grid_h3, hora, ST_ASTEXT(ANY_VALUE(geometria)) wkt, count(*) n_registros, ANY_VALUE(quantidade_pessoas) populacao | |
from `rj-smtr.br_rj_riodejaneiro_onibus_gps.registros_tratada` t1 | |
join `basedosdados.br_ipea_acesso_oportunidades.estatisticas_2019` t2 | |
on st_intersects(geometria, st_geogpoint(longitude, latitude)) | |
where id_municipio in ( | |
select id_municipio | |
from `basedosdados.br_bd_diretorios_brasil.municipio` | |
where municipio = 'Rio de Janeiro') | |
group by id_grid_h3, hora |
Bota a query nova aqui pfv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a coluna
municipio
mudou paranome
la no diretorios, nao sei como submeter uma mudanca aqui no gist ahah