Ir para o conteúdo

Usuário:Peter/Entrega2024-06grid: mudanças entre as edições

Linha 94: Linha 94:
Ver funções em [[Usuário Discussão:Peter/Entrega2024-06grid]].
Ver funções em [[Usuário Discussão:Peter/Entrega2024-06grid]].


# Gera recortando geometria até nivel 7.5
# Gera recortando geometria até nivel 7.5 sob zero do municipio.
 
# acrescenta mais um se tiver disco
 
 
<syntaxhighlight lang="sql">
<syntaxhighlight lang="sql">
CREATE TABLE grid_br2.poc_NovaFrib AS  
CREATE TABLE grid_br2.poc_NovaFrib AS  
Linha 110: Linha 108:
   WHERE ST_Intersects(geom,(select geom from grid_br2.municipio where isolabel_ext='BR-RJ-NovaFriburgo'))
   WHERE ST_Intersects(geom,(select geom from grid_br2.municipio where isolabel_ext='BR-RJ-NovaFriburgo'))
;
;
---------
DROP VIEW if exists grid_br2.poc_NovaFrib_vw01logistic
DROP VIEW if exists grid_br2.poc_NovaFrib_vw01logistic
;
;
Linha 125: Linha 124:
  FROM grid_br2.poc_NovaFrib r INNER JOIN t
  FROM grid_br2.poc_NovaFrib r INNER JOIN t
   ON r.gid_vbit between t.coverbits and (t.coverbits||b'11111111111111111111111111111111111')
   ON r.gid_vbit between t.coverbits and (t.coverbits||b'11111111111111111111111111111111111')
;
----
CREATE TABLE grid_br2.poc_NovaFrib2 AS
  SELECT *
  FROM osmc.grid_generate_all_levels_logistic(
    2.5,
    'BR',
    (select array_agg(cod_b16h)::text from grid_br2.poc_caruaru_vw01logistic where length(gid_vbit)=37),
    18
  )
;
;
</syntaxhighlight>
</syntaxhighlight>
<pre>
select round(intlevel/10.0,1) as hlevel, length(gid_vbit) as gid_len,      count(*) n,
      round(sqrt(avg(st_area(geom)))/1000.0,2) as side_km
from grid_br2.poc_caruaru_vw01logistic
group by 1,2
order by 1,2;
hlevel | gid_len |  n    | side_km
--------+---------+--------+---------
    7.0 |      22 |    25 |    8.19
    9.5 |      27 |    511 |    1.45
  12.0 |      32 |  14489 |    0.26
  14.5 |      37 | 452818 |    0.05
</pre>
== Testes de busca ==
shp2pgsql -s 4326  -W LATIN1 adm_num_porta_a | psql -U postgres lixo5
2 391

edições