Forked from JoaoCarabetta/intersect_point_to_hexagon
Last active
December 22, 2021 15:54
-
-
Save fernandascovino/b625e0990aee959d08d34dc1340f9bc1 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 nome = 'Rio de Janeiro') | |
group by id_grid_h3, hora |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment