CNEFE: mudanças entre as edições
Linha 27: | Linha 27: | ||
----- | ----- | ||
shp2pgsql log | psql -q postgres://postgres@localhost/poa | shp2pgsql log | psql -q postgres://postgres@localhost/poa | ||
</pre> | |||
Melhorando os dados: | |||
<pre> | |||
drop view if exists vw01_log ; | |||
create view vw01_log as select *, regexp_replace( coalesce(nm_tip_log,'') || ' '|| coalesce(nm_tit_log,'') ||' '|| coalesce(nm_log,''), '\s+', ' ', 'g') as via_name from log; | |||
select gid, cd_setor, cd_quadra, cd_face, via_name, tot_res from vw01_log limit 100; | |||
</pre> | </pre> | ||
Edição das 22h28min de 30 de maio de 2024
CNEFE - Cadastro Nacional de Endereços para Fins Estatísticos
Faces de Quadra
Pegar em 4314902_faces_de_logradouros_2021.prj
mkdir /tmp/POA_FACES/ cd /tmp/POA_FACES wget https://dl.digital-guard.org/5d5daa06e048ad8c83c909babee040e26fd8a54a29ed4cef2d2d220a3bd17b84.zip zip -T 5d5daa06e048ad8c83c909babee040e26fd8a54a29ed4cef2d2d220a3bd17b84.zip cd '/tmp/5d5daa06e048ad8c83c909babee040e26fd8a54a29ed4cef2d2d220a3bd17b84/rs_faces_de_logradouros_2021/' cp 4314902* /tmp/POA_FACES
Supor arquivos logradouro em log:
create database poa; \c poa create extension postgis; ----- shp2pgsql log | psql -q postgres://postgres@localhost/poa
Melhorando os dados:
drop view if exists vw01_log ; create view vw01_log as select *, regexp_replace( coalesce(nm_tip_log,'') || ' '|| coalesce(nm_tit_log,'') ||' '|| coalesce(nm_log,''), '\s+', ' ', 'g') as via_name from log; select gid, cd_setor, cd_quadra, cd_face, via_name, tot_res from vw01_log limit 100;
Pontos
Por cidade temos Censo_Demografico_2022/Arquivos_CNEFE/Municipio, direto latLong em srid=4326.
Pelo cabeçalho podemos copiar para uma tabela texto,
CREATE TABLE ibge_cnefe2022 ( COD_UNICO_ENDERECO text, COD_UF text, COD_MUNICIPIO text, COD_DISTRITO text, COD_SUBDISTRITO text, COD_SETOR text, NUM_QUADRA text, NUM_FACE text, CEP text, DSC_LOCALIDADE text, NOM_TIPO_SEGLOGR text, NOM_TITULO_SEGLOGR text, NOM_SEGLOGR text, NUM_ENDERECO text, DSC_MODIFICADOR text, NOM_COMP_ELEM1 text, VAL_COMP_ELEM1 text, NOM_COMP_ELEM2 text, VAL_COMP_ELEM2 text, NOM_COMP_ELEM3 text, VAL_COMP_ELEM3 text, NOM_COMP_ELEM4 text, VAL_COMP_ELEM4 text, NOM_COMP_ELEM5 text, VAL_COMP_ELEM5 text, LATITUDE real, LONGITUDE real, NV_GEO_COORD text, COD_ESPECIE text, DSC_ESTABELECIMENTO text, COD_INDICADOR_ESTAB_ENDERECO text, COD_INDICADOR_CONST_ENDERECO text, COD_INDICADOR_FINALIDADE_CONST text, COD_TIPO_ESPECI text ); copy ibge_cnefe2022 from '/tmp/POA_FACES/4314902_PORTO_ALEGRE.csv' with (format CSV, delimiter ';', header);