Skip to content

Commit

Permalink
rm some sql fkt
Browse files Browse the repository at this point in the history
Signed-off-by: qGYdXbY2 <[email protected]>
  • Loading branch information
qGYdXbY2 committed Nov 9, 2023
1 parent 14c31a9 commit b6f2e5d
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions xyz-psql-connector/src/main/resources/xyz_ext.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3316,60 +3316,6 @@ FROM (
) sub
$$;
------------------------------------------------
--- qk_inhabited - return all qk at specific level that intersects with geo
CREATE OR REPLACE FUNCTION qk_inhabited(iqk text, mlevel integer, geo geometry) RETURNS TABLE(qk text)
LANGUAGE plpgsql IMMUTABLE
AS $$
declare
bFound boolean := false;
g geometry;
begin
for lastDigit in 0..3 loop
qk = iqk || lastDigit;

g = xyz_qk_qk2bbox( qk );
bFound = ( (geo && g) and st_intersects( geo, g ));

if bFound then
if length( qk ) >= mlevel then
return next;
else
return query
select r.qk from qk_inhabited(qk, mlevel, geo ) r;
end if;
end if;
end loop;
end
$$;
------------------------------------------------
------------------------------------------------
CREATE OR REPLACE FUNCTION qk_inhabited_g(iqk text, mlevel integer, geo geometry) RETURNS TABLE(qk text, clip geometry)
LANGUAGE plpgsql IMMUTABLE
AS $$
declare
bFound boolean := false;
g geometry;
begin
for lastDigit in 0..3 loop
qk = iqk || lastDigit;

g = xyz_qk_qk2bbox( qk );
bFound = ( (geo && g) and st_intersects( geo, g ));

if bFound then
clip = ST_MakeValid( ( select st_collect((o.r).geom) from ( select ST_Dump( st_intersection( geo, g ) ) as r ) o where ST_GeometryType((o.r).geom ) in ( 'ST_Polygon', 'ST_MultiPolygon' ) ) );
-- clip = ST_MakeValid( st_buffer( st_intersection( geo, g ),0) );
if length( qk ) >= mlevel then
return next;
else
return query
select r.qk, r.clip from qk_inhabited_g(qk, mlevel, clip ) r;
end if;
end if;
end loop;
end
$$;
------------------------------------------------
------------------------------------------------
CREATE OR REPLACE FUNCTION htile_bbox(qk text)
returns geometry AS
Expand Down

0 comments on commit b6f2e5d

Please sign in to comment.