Skip to content

geohash_cover_geoms precisa revisão de condição #9

@ppKrauss

Description

@ppKrauss

Ver fonte da função aqui.
A função lixo() abaixo demonstra que há uma falha.

CREATE or replace FUNCTION lixo(
  input_geom geometry,
  input_prefix text     DEFAULT ''
) RETURNS TABLE(ghs text, is_contained boolean)  AS $f$
  WITH t0 AS ( SELECT ST_GeoHash(input_geom) AS ghs0 )
   SELECT ghs0, NULL
   FROM t0
   WHERE ghs0 LIKE input_prefix||'%'

  UNION ALL  -- theoretically never duplicates

   SELECT ghs, is_contained
   FROM (
     SELECT ghs, t1.geom,
            ST_Contains(input_geom,t1.geom) as is_contained
     FROM geohash_GeomsFromPrefix(input_prefix) t1, t0
     WHERE ST_Intersects(t1.geom,input_geom)
   ) t2
$f$ LANGUAGE SQL IMMUTABLE;

SELECT g.* FROM ec_azores_geom t, LATERAL lixo(t.geom,'6') g; -- teste1
   -- 6pr | f
   -- 6px | f
SELECT g.* FROM ec_azores_geom t, LATERAL lixo(t.geom,'6p') g; -- teste2
 -- 6   | 
 -- 6p  | f
 -- 6r  | f

SELECT ghs FROM ec_azores_geom t, LATERAL geohash_cover_geoms(t.geom,'6',NULL) g;
  --  6p,  6r

---- BUG:
SELECT ghs FROM ec_azores_geom t, LATERAL geohash_cover_geoms(t.geom,'6p',NULL,false) g; -- vazio!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions