2 583
edições
mSem resumo de edição |
Sem resumo de edição |
||
Linha 94: | Linha 94: | ||
[[Arquivo:Lixo-exemplo-bug-ilustra1.png|miniaturadaimagem|exemplo de https://test.osm.codes/BR-PB-SaoJoaoCariri~53]] | [[Arquivo:Lixo-exemplo-bug-ilustra1.png|miniaturadaimagem|exemplo de https://test.osm.codes/BR-PB-SaoJoaoCariri~53]] | ||
Em alguns casos como SaoJoaoCariri ainda cabe o uso de uma cobertura-base mais densa: neste caso com 31 celulas. E talvez avaliar de um pouco mais de 100 m2 ajude a descartar celulas de poeira. | Em alguns casos como SaoJoaoCariri ainda cabe o uso de uma cobertura-base mais densa: neste caso com 31 celulas. E talvez avaliar de um pouco mais de 100 m2 ajude a descartar celulas de poeira. | ||
== Grade científica municipal == | |||
Para apenas um caracter, como o último dígito não é hexadecimal, apenas 834 municípios contemplam. Para 2 caracteres (''covers_frstdigit''), incluem-se mais 3787-834=2953 municípios. Ainda bom já que as coberturas possuem 5, então economizam o prefixo de 5-2=3 dígitos através do nome abreviado do município. | |||
Todos os restantes apresentam coberturas municipais com mais de 16 células, de modo que precisam ser primeiro aglutinadas, ver segunda query. | |||
<syntaxhighlight lang="sql"> | |||
CREATE VIEW tmp_br_gradecientifica_direta16 AS | |||
SELECT *, cardinality(covers_frstdigit)=n_covers AS is_eq | |||
FROM ( | |||
select isolabel_ext, length(covers[1]) len, | |||
array_text_to_distright(covers,2) as covers_frstdigit, -- para 1 só usar array_text_to_distright(covers) | |||
cardinality(covers) n_covers | |||
from ( | |||
select isolabel_ext, array_agg( natcod.vbit_to_baseh(substring(cbits,11),16,true) order by cbits) AS covers | |||
from osmc.coverage | |||
where not(is_overlay) and isolabel_ext like 'BR-%-%' | |||
group by 1 | |||
) t1 where cardinality(covers)<=16 | |||
) t2 | |||
WHERE cardinality(covers_frstdigit)=n_covers | |||
ORDER BY 5 desc,1 | |||
; | |||
-- restantes 1783 municípios resolvidos fazendo agregação parcial com corte do último dígito. Em média cortamos 3 dígitos com o prefixo | |||
SELECT *, cardinality(covers_frstdigit) AS n_covers2 | |||
FROM ( | |||
select isolabel_ext, length(covers[1]) len, | |||
array_text_to_distleft( array_text_to_distright(covers,3), 2) as covers_frstdigit, -- para 1 só usar array_text_to_distright(covers) | |||
cardinality(covers) n_covers | |||
from ( | |||
select isolabel_ext, array_agg( natcod.vbit_to_baseh(substring(cbits,11),16,true) order by cbits) AS covers | |||
from osmc.coverage | |||
where not(is_overlay) and isolabel_ext like 'BR-%-%' | |||
group by 1 | |||
) t1 where cardinality(covers)>16 | |||
) t2 | |||
ORDER BY 5 desc,1 | |||
; | |||
</syntaxhighlight> | |||
Exemplos:<pre> | |||
isolabel_ext | len | covers_frstdigit | n_covers | is_eq | |||
--------------------------------+-----+-------------------------+----------+------- | |||
BR-AL-Belem | 6 | {J,K,N,P,S,T,Y,Z} | 8 | t | |||
BR-AL-Canapi | 5 | {H,M,R,V} | 4 | t | |||
BR-AL-CoqueiroSeco | 6 | {J,N,P,T,Y} | 5 | t | |||
BR-AL-PaoAcucar | 5 | {H,M,R,V} | 4 | t | |||
BR-AL-Paripueira | 6 | {J,K,N,P,S,T,Z} | 7 | t | |||
BR-AL-Penedo | 5 | {H,M,R,V} | 4 | t | |||
BR-AL-SantaLuziaNorte | 6 | {J,K,N,P} | 4 | t | |||
BR-AL-Satuba | 6 | {J,K,P,S,Y,Z} | 6 | t | |||
BR-AM-Jurua | 4 | {G,Q} | 2 | t | |||
BR-BA-Abaira | 5 | {H,M} | 2 | t | |||
BR-BA-Alagoinhas | 5 | {H,M,R,V} | 4 | t | |||
... | |||
BR-TO-PortoAlegreTocantins | 5 | {H,R} | 2 | t | |||
BR-TO-PresidenteKennedy | 5 | {H,M,R,V} | 4 | t | |||
BR-TO-RioBois | 5 | {H,M,R,V} | 4 | t | |||
BR-TO-TaipasTocantins | 5 | {H,M,R,V} | 4 | t | |||
BR-TO-Tupirama | 5 | {H,M,R} | 3 | t | |||
BR-TO-Tupiratins | 5 | {H,M,R,V} | 4 | t | |||
(834 rows) | |||
isolabel_ext | len | covers_frstdigit | n_covers | |||
---------------------------------+-----+---------------------------------------------------+--------- | |||
BR-AC-Acrelandia | 5 | {1H,1R,1V,3H,3M,4R,6H} | 7 | |||
BR-AC-AssisBrasil | 5 | {1H,8R,8V,9R,aH,aM,aR,aV,bH,bM,bR,dV,fM} | 13 | |||
BR-AC-Brasileia | 5 | {1M,aM,bH,bM,bR,bV,cR,cV,eH,eM,eR} | 11 | |||
BR-AC-Bujari | 5 | {2H,5R,5V,7H,7M,7R,7V,dH,dM} | 9 | |||
BR-AC-Capixaba | 5 | {0H,5M,aR,aV,fV} | 5 | |||
BR-AC-CruzeiroSul | 4 | {2Q,3Q,8G,9G} | 4 | |||
BR-AC-Epitaciolandia | 5 | {cV,dR,eH,eM,eV,fH} | 6 | |||
BR-AC-Feijo | 4 | {3G,3Q,6Q,9G,cG} | 5 | |||
BR-AC-Jordao | 5 | {0V,1R,2M,2V,3H,3M,3R,3V,8M,9H,9M,9R,9V} | 13 | |||
... | |||
BR-TO-TaipasTocantins | 5 | {6H,6M,6R,6V} | 4 | |||
BR-TO-Talisma | 5 | {4H,4M,4R,4V,5H,5R,6M,7H,7M} | 9 | |||
BR-TO-Tocantinia | 5 | {2H,2M,2R,2V,8H,8M} | 6 | |||
BR-TO-Tocantinopolis | 5 | {1M,bH,bM,bR,bV} | 5 | |||
BR-TO-Tupirama | 5 | {8R,aH,aM} | 3 | |||
BR-TO-Tupiratins | 5 | {0H,0M,aR,aV} | 4 | |||
BR-TO-Wanderlandia | 5 | {8M,8V,9H,9R,aM} | 5 | |||
BR-TO-Xambioa | 5 | {8R,aH,aR,dV,fM} | 5 | |||
(3787 rows) | |||
isolabel_ext |len | covers_frstdigit |n_covers | n_covers2 | |||
-----------------------+----+------------------------------------------------+---------+----------- | |||
BR-AP-LaranjalJari | 5 | {23,29,2f,33,36,4a,83,84,85,...,8d,98} | 29 | 15 | |||
BR-MT-Querencia | 5 | {07,0d,0f,10,11,12,13,14,16,18,19,1a,bb} | 29 | 13 | |||
BR-AC-Tarauaca | 5 | {38,39,3a,3b,3c,3d,3e,3f,90,91,94,95} | 28 | 12 | |||
BR-AM-Beruri | 5 | {14,b1,b2,b3,b6,b8,b9,bb,bc,bd,be,bf} | 28 | 12 | |||
BR-MS-RibasRioPardo | 5 | {07,0c,0d,0e,0f,12,18,1a,24,25,27,30} | 29 | 12 | |||
... | |||
BR-PR-Marumbi | 6 | {6b,6e,c4} | 17 | 3 | |||
BR-RN-SaoVicente | 6 | {de,df,f5} | 17 | 3 | |||
BR-RS-Cidreira | 6 | {a3,a4,a6} | 17 | 3 | |||
BR-SC-Mondai | 6 | {54,56,57} | 17 | 3 | |||
BR-SC-SaoJoseCedro | 6 | {73,76,77} | 18 | 3 | |||
(1783 rows) | |||
</pre> | |||
==Ver também== | ==Ver também== |
edições