--############################################################################## -- -- Auth: Paul Brown -- -- $Header: /usr/local/devel/montage/contrib/BigSur/Schema/RCS/bigsur_axis.msql,v 1.4 1994/12/01 00:27:16 pbrown Exp pbrown $ -- --##################################################################### -- --##################################################################### -- -- -- The intention of the Axis/Grid section of the BigSur schema is to -- provide a basic set of table templates which may be used to contruct -- more complicated schemas in each of the applications. Becuase of the -- way inheritance operates in the OR data model, these template tables -- can also be used to query on the union of each application's -- data sets. This faciliates sharing of data which the boss -- considers a highly desirable feature of the BigSur system. -- -- This effort is greatly assisted by the SAIF and FGDC standards, from -- which we have adoptedboth a higher level structure and as many names as -- we can. -- -- This section tries to explain how Grids and Axes work in the BigSur -- schema. We'll begin with a simple example and show the key features of -- it's structure. Then we'll develop an abstraction of this structure -- which describes not just the example Grid, but most other Grids as well. -- Then we'll map this abtraction maps into our tables, and finally show -- how the original example Grid would fit. -- -- For those of you who are already very numerate in the area of -- 2 and 3 d geometry, please feel free to comment on my explaination -- and suggest changes. -- -- Imagine a huge glass cube, one kilometer along each of it's sides and -- open at one end like an aquarium, which has been placed over an area -- (obviously 1 kilometer square). Along each of the corners of the cube, -- marks have been inscribed at one meter intervals. From these marks, an -- imaginary line may be drawn to another mark on the opposite side of -- the cube. -- -- The totality of these connections creates a lattice of smaller cubes -- which total ( 1000 x 1000 x 1000 ). -- -- Further, because the cube is 'fixed' in space (one presumes 1km -- cubic glass cubes don't move too easily) any point inside the -- cube can be described in absolute terms by applying some -- function to the location within the cube (expressed as some combination -- of numbers of each axis, say [ 320, 450, 632 ] ), the spacing -- along the axis ( 1 meter per grid spacing, in our example) and -- each Axis' origin ( Lat x Long x height_above_sea level). -- -- Thus our cube is located at 32' North x 130' West x 1000 -- Meters_above_Sea_Level. -- -- Assuming that this origin maps to the [0,0,0] point in the cube/grid, -- this a location [ 320, 450, 632 ] turns into; -- -- ( 32' North + 320 x 1 metre ), (130' West + 450 x 1 metre) x etc -- -- In this manner the 3 dimensional space enclosed by the cube is -- 'Gridded'. -- -- Each of the Axes of this Cube represents some extension in space. -- Each Axes is divided in a manner which allows the naming of any -- space enclosed by the cube as a range. -- -- It is possible to move this cube. By great effort of will the cube's -- location may be translated from the initial origin up, north/south or -- east/west. The dimensions and size of the cube stays the same (the -- cube is a relative entity) but the grid it represents changes. This -- change is because some/all of the Grid's Axis have changed. -- -- Further, it is possible to use the same Axis (say, Lax, Long) at a fixed -- height to create a new Grid (which will be two-d). -- -- An important feature of the Axis/Grid relationship is made necessary -- by the needs of users who wish to 'hyperslab' a Grid. Essentially, -- Hyperslabbing means reducing the Grid in some way; either by restricting -- each of the dimensions (and hence constructing a smaller cube) or -- by eliminating one of the dimensions entirely (and so constructing -- another Grid of a different kind) or some combination of both. What this -- implies is that whatever schema we employ needs to model abstract -- collections of Axes which may not even have a spatial component. -- -- For example, someone may be interested in constructing a Grid of -- Altitide and Time to chart air temperature over some area. The -- resulting Grid has no explicit spatial component (although it does -- have an *implied* spatial component in the same way that a Raster -- image has an *implied* temporal component). -- -- This leads us to the following observations; -- -- 1. Grids consists of a set of Axis. -- -- 2. An Axis is independent of the Grids in which it pariticipates. -- -- 3. An Axis has origin, spacing, count. The Grid's origin, spacing and -- size are determined by the combination of the Axis that go to -- make up the Grid. -- -- 4. Grids can be created from arbitrary groupings of Axes. -- -- The Axis relation turns the GridFrameWork and GridReference -- classes in SAIF 'on their side'; that is, it does a Relational -- view of them. -- -- -- BigSurAxis = This stores the information about Axis as they are -- included into Grids. -- -- axisName - Some sensible name for the Axis. -- -- axisType - Axes are divided into Types based on the nature -- of their dimension. Examples of Axis Types would -- be; -- -- 'Spatial','Temporal','Abstract','Functional' -- -- axisAccuracy - Because Grid locations can never br placed with -- complete precision it is prudent to record the -- degree of innaccuracy assigned to the location of -- the Axis' Origin and Spacing. -- -- This is necessary in some Grids but not others, -- hence the attribute is nullable. -- -- 0.005, for example, reflects 0.5% inaccuracy. -- -- positionofOrigin - This reflects the Axis' origin in real world -- units (the same as spacing). -- -- gridDimensions - This is the size of the Axis in terms of the -- number of values along the Axis. In our example -- above, each axis has 1000 spacings along it. -- -- 44, 72, 1024 etc -- -- gridSpacing - This is the measure of the distance in real world -- units between each of the Axis positions. -- -- 4, 5, 6.23 etc -- -- offsetStructure - If each alternative pass of the Axis' values is -- offset or indented, then this needs to be recorded -- here. REF: SAIF -- -- units - This is the real world unit in which to express -- gridSpacing. It is also the unit in which to -- express positionOfOrigin and gridSpacing. -- -- Degrees -- -- ordering - Quirky patterns. In some files the data is located -- so that it 'sweeps' back and forth, alternatively -- left to right then right to left etc. The nullable -- default is as normal. -- -- originCoordinate - This is the coordinates for the local origin -- of the Axis. This is going to be all 1's or -- all 0's. -- -- originCorner - This is the corner of the Grid which refers -- to the -- CREATE TABLE BigSurAxis OF NEW TYPE BigSurAxis_t ( axisName text , axisType text , axisAccuracy double precision default '0.005', positionOfOrigin double precision , -- SAIF Naming gridDimensions integer , -- SAIF Naming gridSpacing double precision , -- SAIF Naming offsetStructure text default 'none', -- SAIF Naming units text , -- SAIF Naming ordering text, -- SAIF Naming originCoordinates integer , -- SAIF Naming CHECK ( originCoordinates <= gridDimensions ) ) UNDER Description; -- -- -- NOTE: The instance of the Axis relation used by the GCM application -- will include a notion of Recta-linear grids. This is the -- case where one of the Axis consists of something which is -- not a regular division of space; a list of points which -- represent cities, for example. -- -- BigSurGrid - This is the BigSur implementation of the Grid type -- for use in both applications. -- -- gridName -- This is some unique name. -- -- gridAxisCount -- Number of Axes in the Grid. -- -- originCorner -- This is the corner of the grid which -- reflects the corner of the Grid 'tied to' -- the originPoint. -- -- Note that there are subtelties about the -- Grid's origin, orientation and layout. We -- are modifying the SAIF specification on -- originCoordinates. (Our originCoordinates mean -- something different from what SAIF's -- originCoordinates mean. Refer: BigSur html) -- -- cellPositionAtCorner -- This is the boolean value which records whether -- or not the origin of the Grid is the corner -- of the cell indicated by te Origin, or in the -- middle. This should really be part of the -- axis, but I'm going to include it here -- for completeness. -- CREATE TABLE BigSurGrid OF NEW TYPE BigSurGrid_t ( gridName text , gridAxisCount integer , originCorner text , -- SAIF Naming cellPositionAtCorner boolean DEFAULT 'T' ) UNDER Description; -- -- Note: gridRank was formerly used to cope with the recto-linear -- grids. In the case of the GCM data, this will be -- created in the inherited relation which is so -- defined over the existing one. In all other Grid -- types gridRank is equivalent to gridAxisCount. -- -- -- BSGridAxisRes - This is a resolution table describing the relationship -- between Axes and Grids. An Axis may be used in several -- Grids and in order to determine which Axes are used in -- which Grids this table offers normalized searches. -- -- BigSurGrid - The BigSurGrid being associated with the Axes. -- -- axis - The BigSurAxis in the order described. -- -- seqNum - Shows order of the Axes in the Grid. -- CREATE TABLE GridAxisRes OF NEW TYPE GridAxisRes_t ( BigSurGrid ref(BigSurGrid_t) , BigSurAxis ref(BigSurAxis_t) , seqNum integer ); -- --CREATE VIEW SAIFGrid --( positionOfOrigin, unitsofOrigin, ordering, originCorner, -- cellPositionAtCorner, originCoordinates, gridDimensions, -- gridSpacing, offsetStructure, units ) --AS SELECT -- deref(BSA.BigSurAxis).originCorner, -- deref(BSA.BigSurAxis).units, -- BSA.seqNum, -- deref(BSA.BigSurAxis).originCoordinate, -- deref(BSA.BigSurGrid).cellPositionatCorner, -- 0, -- deref(BSA.BigSurAxis).gridDimensions, -- deref(BSA.BigSurAxis).gridSpacing, -- 'None', -- deref(BSA.BigSurAxis).units -- FROM BSGridAxisRes BSA; ---- ---- ---- GRANT ALL ON BigSurAxis TO PUBLIC; GRANT USAGE ON TYPE BigSurAxis_t TO PUBLIC; GRANT ALL ON BigSurGrid TO PUBLIC; GRANT USAGE ON TYPE BigSurGrid_t TO PUBLIC; GRANT ALL ON GridAxisRes TO PUBLIC; GRANT USAGE ON TYPE GridAxisRes_t TO PUBLIC; --