Skip to content

Instantly share code, notes, and snippets.

View fernandascovino's full-sized avatar

Fernanda Scovino fernandascovino

View GitHub Profile
@fernandascovino
fernandascovino / intersect_point_to_hexagon
Last active December 22, 2021 15:54 — forked from JoaoCarabetta/intersect_point_to_hexagon
Intersect point to hexagon - SQL Base dos Dados
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