Skip to content

Testing autocover

Peter edited this page Nov 7, 2022 · 1 revision

Bug pois não aumenta o percentual com o aumento da amostragem. O certo é simplsmente agrupar com um dígito a menos. As amostragens precisam se intencificar usando mais dígitos ... Ver cover original em https://github.com/AddressForAll/pg_pubLib-v1/blob/main/src/pubLib05pgis-geohash.sql

Refazer autocover de https://github.com/osm-codes/GGeohash/blob/main/src/step02def-libGGeohash.sql

SELECT isolabel_ext, 
       max(n_cells) as n_cells,
       max(jarea) as jarea,
       SUM(area_frac) as area_sum,
       100.0*SUM(area_frac)/max(jarea) as perc
FROM (        
  SELECT isolabel_ext, cardinality(cover) as n_cells, t2.ghs, jarea,
         st_area(st_intersection(t.geom,t2.geom)) as area_frac
  FROM (
    SELECT isolabel_ext, geom, st_area(geom) as jarea, ggeohash.classic_autocover(geom,31,1000) as cover
    FROM  optim.jurisdiction_geom
    WHERE isolabel_ext ~ '^..$' 
    order by 1
  ) t, LATERAL geohash_GeomsMosaic(cover) as t2
) t2
GROUP BY 1
ORDER BY 1
;