Skip to content

LIXO, contagens

Peter edited this page Oct 26, 2018 · 1 revision

Estatísticas para confirmações e decisões básicas... Estatísticas sobre o backup definido em src/prepare01.sh. Versão atual em brazil-latest.osm.md. Scripts SQL:

Quantidade de itens

Resultados dos relatórios REL1, REL2 e REL3. Números na forma 1.234.567,00.

n_nodes n_ways n_rels n_tot_eles
89.942.954 8.335.298 151.288 98.429.540
n_pts n_lns n_pgs n_tot_geoms
1.833.326 3.869.230 4.396.944 10.099.500
n_lns_w n_lns_r n_lns2 n_pgs_w n_pgs_r n_pgs2
3.796.335 72.895 3.869.230 4.310.669 86.275 4.396.944

Quantidade de tags

Resultados de REL4, relativo ao número de elementos nas tags de line's:

n n_r avg_len_r max_len_r min_len_r
3.869.230 72.895 13,9 480 5
n_w avg_len_w max_len_w min_len_w
3.796.335 7,3 37 6

Resultados de REL5, relativo ao número de elementos nas tags de polygon's:

n n_r avg_len_r max_len_r min_len_r
4.396.944 86.275 7,8 480 5
n_w avg_len_w max_len_w min_len_w
4.310.669 6,8 58 6

Resultados de REL6, relativo ao número de elementos nas tags de way's:

n avg_len max_len min_len
8.335.298 2,3 56 0

Resultados de REL7, relativo ao número de elementos nas tags de relation's:

n avg_len max_len min_len
151.288 3,5 476 0

(LIXO REFAZER) Para comparar com REL4 e REL5, RELs 7a e 7b:

n avg_len max_len min_len
86275 4.2 476 1
n avg_len max_len min_len
1 2.0 2 2

RELs 6a (rels) e 6b (ways):

n avg_len max_len min_len
60 3.0 10 2
n avg_len max_len min_len
4310669 2.2 56 1

Scripts

-- REL7a e 7b: variações de REL7.
SELECT count(*) n, round(avg(len),1) avg_len, 
         max(len) max_len, min(len) min_len
FROM (
    select (SELECT COUNT(*) FROM jsonb_object_keys(pw.tags)) len 
    from  planet_osm_rels pw WHERE id IN (select -osm_id FROM planet_osm_polygon WHERE osm_id<0) 
) t;

-- REL6:   lenta
SELECT count(*) n, round(avg(len),1) avg_len, 
         max(len) max_len, min(len) min_len
FROM (
    select (SELECT COUNT(*) FROM jsonb_object_keys(pw.tags)) len 
    from  planet_osm_ways pw -- REL7: planet_osm_rels
) t;

-- REL4:
SELECT count(*) n, 
       count(len_r) n_r, round(avg(len_r),1) avg_len_r, 
         max(len_r) max_len_r, min(len_r) min_len_r, 
       count(len_w) n_w, round(avg(len_w),1) avg_len_w, 
         max(len_w) max_len_w, min(len_w) min_len_w 
FROM (
  select CASE WHEN osm_id<0 THEN len ELSE NULL END len_r, 
         CASE WHEN osm_id>0 THEN len ELSE NULL END len_w 
  FROM (
    select osm_id, array_length(akeys(tags),1) len 
    from  planet_osm_line -- REL5: planet_osm_polygon
  ) t1
) t2;

-- REL1:
SELECT n_nodes, n_ways, n_rels, n_nodes+n_ways+n_rels n_tot_eles
FROM (SELECT 
  (select count(*) from planet_osm_nodes) n_nodes -- = 89942954; 
 ,(select count(*) from planet_osm_ways) n_ways -- = 8335298;
 ,(select count(*) from planet_osm_rels) n_rels -- = 151288.
) t;
-- REL2:
SELECT n_pts, n_lns, n_pgs, n_pts+n_lns+n_pgs n_tot_geoms, n_lns_w, n_lns_r, n_lns_w + n_lns_r x
FROM (SELECT 
  (select count(*) from planet_osm_point) n_pts -- = 89942954; 
 ,(select count(*) from planet_osm_line) n_lns -- = 8335298;
 ,(select count(*)  from planet_osm_line where osm_id IN (select id from planet_osm_ways)) n_lns_w --3796335; 
 ,(select count(*)  from planet_osm_line where -osm_id IN (select id from planet_osm_rels)) n_lns_r --72895; 
 ,(select count(*) from planet_osm_polygon) n_pgs -- = 151288.
) t;
-- REL3:
SELECT n_lns_w, n_lns_r, n_lns_w + n_lns_r n_lns2, n_pgs_w, n_pgs_r, n_pgs_w+n_pgs_r n_pgs2
FROM (SELECT 
 (select count(*)  from planet_osm_line where osm_id IN (select id from planet_osm_ways)) n_lns_w --3796335 
 ,(select count(*)  from planet_osm_line where -osm_id IN (select id from planet_osm_rels)) n_lns_r --72895
 ,(select count(*)  from planet_osm_polygon where osm_id IN (select id from planet_osm_ways)) n_pgs_w
 ,(select count(*)  from planet_osm_polygon where -osm_id IN (select id from planet_osm_rels)) n_pgs_r
) t;