CalCOFI / workflows

helper scripts in R for common workflows
https://calcofi.io/workflows
MIT License
0 stars 0 forks source link

migrate priority datasets into database #1

Open bbest opened 2 years ago

bbest commented 2 years ago

Priority databases to migrate

bbest commented 2 years ago

Loading spatial data for vector tiles, starting with sanctuaries

To get this sanctuaries to load into tile.calcofi.io after loading the spatial features into the database:

Ran the following SQL in DBeaver:

SELECT UpdateGeometrySRID('aoi_fed_sanctuaries','geom',4326);

after checking with:

SELECT
    nspname AS SCHEMA,
    relname AS TABLE,
    relkind, 
    typname, 
    attname AS geometry_column,
    postgis_typmod_srid (atttypmod) AS srid,
    postgis_typmod_type (atttypmod) AS geometry_type
FROM
    pg_class c
    JOIN pg_namespace n ON (c.relnamespace = n.oid)
    JOIN pg_attribute a ON (a.attrelid = c.oid)
    JOIN pg_type t ON (a.atttypid = t.oid)
WHERE
  relkind IN('r', 'v', 'm') AND 
  typname = 'geometry' AND 
  postgis_typmod_srid (atttypmod) != 0 AND
  relname = 'aoi_fed_sanctuaries';

References: