--
-- f_spatialcontextgroup
--
DROP TABLE IF EXISTS f_spatialcontextgroup;

create table f_spatialcontextgroup (
    scgid           serial not null,
    crsname         varchar(255),
    crswkt          varchar(2048),
    srid            bigint,
    areaunit        varchar(30),
    lengthunit      varchar(30),
    positionxyunit  varchar(30), 
    positionzunit   varchar(30),
    volumeunit      varchar(30),
    measureunit     varchar(30),
    xtolerance      double precision not null,
    ztolerance      double precision,
    minx            double precision not null, -- TODO: xmin is a system column name
    miny            double precision not null,
    minz            double precision,
    maxx            double precision not null, -- TODO: xmax is a system column name
    maxy            double precision not null,
    maxz            double precision,
    extenttype      varchar(1) not null,

    CONSTRAINT f_spatialcontextgroup_pk PRIMARY KEY (scgid)
);

COMMENT ON TABLE f_spatialcontextgroup IS 'TODO';

insert into f_spatialcontextgroup
(crsname, xtolerance, ztolerance, minx, miny, maxx, maxy, extenttype)
values
('', 0.001, 0.001, -2000000, -2000000, 2000000, 2000000, 'S');

