Add function to obtain existing overviews of a table
This commit is contained in:
parent
496f079b1c
commit
6ea63af974
@ -1,3 +1,19 @@
|
||||
Overviews are tables that represent a *reduced* version of a dataset intended
|
||||
for efficient rendering at certain zoom levels while preserving the
|
||||
general visual appearance of the complete dataset.
|
||||
|
||||
The *reduction* consists in a fewer number of records
|
||||
(while each overview record may represent an aggregation of multiple records)
|
||||
and/or simplified record geometries.
|
||||
|
||||
Overviews are created through the `CDB_CreateOverviews`.
|
||||
|
||||
The `CDB_Overviews` function can be used determine what overview tables
|
||||
exist for a given dataset table and which zoom levels correspond tt
|
||||
|
||||
|
||||
### CDB_CreateOverviews
|
||||
|
||||
Create overviews for vector dataset.
|
||||
|
||||
#### Using the function
|
||||
@ -26,3 +42,18 @@ CDB_CreateOverviews(table_name, ref_z_strategy, reduction_strategy)
|
||||
- **base_table_name** regclass, base table to be reduced.
|
||||
- **base_z** integer, base Z level assigned to the base table.
|
||||
- **overview_z** integer, Z level for which to generate the overview.
|
||||
|
||||
### CDB_Overviews
|
||||
|
||||
Obtain overview metadata for a given table (existing overviews)
|
||||
|
||||
```sql
|
||||
SELECT CDB_Overviews('table_name');
|
||||
--- Return existing overview Z levels and corresponding tables
|
||||
```
|
||||
|
||||
#### Arguments
|
||||
|
||||
CDB_Overviews(table_name)
|
||||
|
||||
* **table_name** regclass, table for which overviews will be generated
|
||||
|
@ -1,3 +1,20 @@
|
||||
-- Return existing overviews (if any) for a given dataset table
|
||||
-- Scope: public
|
||||
-- Parameters
|
||||
-- reloid: oid of the input table.
|
||||
-- Return relation of overviews for the table with
|
||||
-- z level of the overview and overview table, ordered by z.
|
||||
CREATE OR REPLACE FUNCTION CDB_Overviews(reloid REGCLASS)
|
||||
RETURNS TABLE(z integer, overview_table REGCLASS)
|
||||
AS $$
|
||||
SELECT
|
||||
substring(cdb_usertables from '\d+$')::integer as z,
|
||||
cdb_usertables::regclass as overview_table
|
||||
FROM CDB_UserTables()
|
||||
WHERE cdb_usertables SIMILAR TO reloid::text || '_ov[0-9]+'
|
||||
ORDER BY z;
|
||||
$$ LANGUAGE SQL;
|
||||
|
||||
-- Calculate the estimated extent of a cartodbfy'ed table.
|
||||
-- Scope: private.
|
||||
-- Parameters
|
||||
|
Loading…
Reference in New Issue
Block a user