User's Guide and Reference
This section describes the relationship between
spatial reference systems and coordinate systems, and explains how to create a
spatial reference system from the Control Center.
This section continues the discussion of coordinate systems that was begun in The nature of spatial data. Then it expands on the definition of spatial
reference systems that is provided in Developing and implementing a GIS project. It also provides guidelines for determining what
values to assign to a spatial reference system's parameters.
You can think of a coordinate system in terms
of an imaginary grid that covers a specific geographic area. Examples
include a grid that covers the earth, a grid that covers a nation, or a grid
that covers a region in a state. Each geographic feature in the area is
situated at the intersection of an east-west gridline and a north-south
gridline. A value, called an
X coordinate, indicates where the location lies on the east-west
gridline. Another value, a
Y coordinate, indicates where the location lies on the north-south
gridline. Both values reference the location to the grid's center,
or origin.
The X and Y coordinates at the origin are both zero. From the origin
eastward, X coordinates are positive; from the origin westward, they are
negative. Similarly, from the origin northward, Y coordinates are
positive; from the origin southward, they are negative. For an
illustration of this distribution, consider the following generalized
example: Coordinate system A includes a grid that covers a large
metropolitan area. An X coordinate of 7 would denote a position that is
seven units of measurement eastward from the origin of this grid. An X
coordinate of -9.5 would denote a position that is nine and a half
units of measurement westward from the origin.
Each data item in a spatial column includes either (1) an X coordinate and a Y
coordinate that define the location of a geographic feature or (2) multiple X
and Y coordinates that define the locations of the parts of a feature, or that
define the area that a feature covers. Two other kinds of
values--a Z coordinate and a measure--can also
be included. Unlike X and Y coordinates, Z coordinates and measures are
not used in DB2 Spatial Extender to define locations or areas. Rather,
they simply convey information required by a GIS application. A Z
coordinate typically indicates the height or depth of a geographic
feature. Z coordinates above the origin are positive; Z
coordinates below it are negative. A measure is numeric; it can
convey any sort of information. For example, suppose that you are
representing oil wells in your GIS. If you require your applications to
process values that denote shot point IDs for seismic data, you could store
these values as measures.
As indicated in Coordinate systems, coordinates, and measures, coordinates can be negative and expressed in
decimals. The same is true for measures. However, to reduce
storage overhead, DB2 Spatial Extender stores each coordinate and measure as a
non-negative integer (that is, as a positive integer or as zero).
Therefore, actual negative and decimal coordinates and measures must be
converted to non-negative integers, so that DB2 Spatial Extender can store
them. Furthermore, you need to tell DB2 Spatial Extender how to make
the conversion. You do this by setting certain parameters.
Parameter settings that are to be used to convert coordinates and measures
within a specific geographic area are collectively called a spatial
reference system.
You can create a spatial reference system by:
- Determining the lowest negative coordinates and measures for the features
that you are representing. (The further from zero a negative value is,
the lower it is. An X coordinate of -10 is lower than an X
coordinate of -5; a measure of -100 is lower than a measure
of -50.)
- Specifying offset factors (or offsets, for
short): values that, when subtracted from negative coordinates and
measures, leave non-negative numbers.
-
Specifying scale factors: values that, when multiplied by
decimal coordinates and measures, yield integers whose precision is at least
the same as that of the coordinates or measures. For example, consider
a coordinate with a precision of four: 92.77. You could
multiply it by a scale factor of 100 to obtain an integer with a precision of
four: 9277.
Before you set parameters for a spatial
reference system, you need to determine the lowest negative X coordinate, Y
coordinate, Z coordinate, and measure in the geographic area that contains the
features that you want information about. You can find out what these
values are by answering the following questions:
- Of the features that you are representing, do any lie west of the origin
of the coordinate system that you are using? If so, what X coordinate
indicates the location or western edge of the westernmost feature? (The answer
will be the lowest of the negative X coordinates that you are dealing
with.) For example, if you are representing oil wells, and some of them
lie to the west of the origin, what X coordinate indicates the location of the
oil well that is furthest west?
- Do any features lie south of the origin? If so, what Y coordinate
indicates the location or southern edge of the southernmost feature? (The
answer will be the lowest of the negative Y coordinates that you are dealing
with.) For example, if you are representing oil wells, and some of them
lie to the south of the origin, what Y coordinate indicates the location of
the oil well that is furthest south?
- If you are going to use Z coordinates to define depth, which feature is
the deepest, and which Z coordinate represents this feature's lowest
point? (The answer will be the lowest of the negative Z coordinates that you
are dealing with.)
- If you are going to include measures in your spatial data, will any be
negative? If so, what is the lowest of the negative measures?
Having ascertained the lowest negative coordinates and measures, add to
each one an amount equal to five to ten percent of its value. For
example, if the lowest negative X coordinate is -100, you could add
-5 to it. This book calls the resulting figure an augmented
value.
Next, specify what offset factors DB2 Spatial Extender should use to
convert negative coordinates and measures to non-negative ones:
-
After you decide what you want your augmented X value to be, specify an offset
that, when subtracted from this value, leaves zero. DB2 Spatial
Extender will then subtract this number from all negative X coordinates to
arrive at a positive value. DB2 Spatial Extender will subtract this
number from all other X coordinates as well.
For example, if the augmented X value is -105, you need to subtract
-105 from it to get 0. DB2 Spatial Extender will then subtract
-105 from all X coordinates that are associated with the features that
you are representing. Because none of these coordinates is greater than
-100, all the values that result from the subtraction will be
positive.
- Similarly, specify offsets that leave 0 when subtracted from the augmented
Y value, the augmented Z value, and the augmented measure.
The offset subtracted from X coordinates is called a false
X. The offsets subtracted from Y coordinates, Z coordinates, and
measures are called false Y, false Z, and false
M, respectively. For instructions on specifying these parameters
from the Control Center, see Creating a spatial reference system from the Control Center.
Next, specify what scale factors DB2 Spatial Extender should use to convert
decimal coordinates and measures to integers:
- Specify a scale factor that, when multiplied by a decimal X coordinate or
a decimal Y coordinate, yields a 32-bit integer. It is advisable to
make this scale factor a factor of 10: 10 to the first power (10), 10 to
the second power (100), 10 to the third power (1000), or, if necessary, a
larger factor. To decide what factor of 10 the scale factor should
be:
- Determine which X and Y coordinates are, or are likely to be, decimal
numbers. For example, suppose that of the various X and Y coordinates
that you will be dealing with, you determine that three of them are decimal
numbers: 1.23, 5.1235, and 6.789.
- Take the decimal coordinate that has the longest decimal precision.
Then determine by what factor of ten this coordinate can be multiplied in
order to yield an integer of equal precision. To illustrate: of
the three decimal coordinates in the current example, 5.1235 has the
longest decimal precision. Multiplying it by ten to the fourth power
(10000) would yield the integer, 51235.
- Determine whether the integer produced by the multiplication that was just
described is too long to store as a 32-bit data item. 51235 is not too
long. But suppose that in addition to 1.23, 5.11235, and
6.789, your range of X and Y coordinates includes a fourth decimal
value, 10006.789876. Because this coordinate's decimal
precision is longer than that of the other three, you would multiply
this coordinate--not 5.1235--by a factor of
10. To convert it to an integer, you could multiply it by 10 to the
sixth power (1000000). But the resulting value, 10006789876, is too
long to store as a 32-bit data item. If DB2 Spatial Extender tried to
store it, the results would be unpredictable.
To avoid this problem, select a factor of 10 that, when multiplied by the
original coordinate, yields a decimal number that DB2 Spatial Extender can
truncate to a storable integer, with minimum loss of precision. In this
case, you could select 10 to the fourth power (10000). Multiplying
10000 by 10006.789876 yields 100067898.76. DB2 Spatial
Extender would truncate this number to 100067898, reducing its accuracy by a
virtually insignificant amount.
- If the features that you are representing have decimal Z coordinates,
follow the foregoing procedure to ascertain a scale factor for these
coordinates. If the features are associated with decimal measures,
follow this same procedure to ascertain a scale factor for these
measures.
The scale factor for X and Y coordinates is called an XY
unit. The scale factors for Z coordinates and measures are called
Z units and M units, respectively. For
instructions on specifying these parameters from the Control Center, see Creating a spatial reference system from the Control Center.
This section gives an overview of the steps to create a spatial reference
system from the Control Center. The overview is followed by details of
how to complete each step.
No authorization is required to perform these steps.
Overview of steps to create a spatial reference system from the
Control Center:
- Open the Create Spatial Reference window.
- Indicate which coordinate system you want to use.
- Specify identifiers for the spatial reference system that you want to
create.
- Determine what ranges of coordinates and measures apply to the geographic
features that you want information about.
- Specify values that can be used to convert negative or decimal coordinates
and measures into data items that DB2 Spatial Extender can store.
- Tell DB2 Spatial Extender to create the spatial reference system that you
want.
Detailed steps to create a spatial reference system from the Control
Center:
- Open the Create Spatial Reference window.
- From the Control Center window, expand the object tree until you find the
Databases folder under the server where you want DB2 Spatial
Extender to run.
- Click the Databases folder. The databases are displayed
in the contents pane on the right side of the window.
- Right-click the database that you enabled for spatial data, and click
Spatial Extender --> Spatial References in the
pop-up menu. The Spatial References window opens.
- From the Spatial References window, click Create. The
Create Spatial Reference window opens.
- From the Create Spatial Reference window, use the Coordinate
system field to indicate what coordinate system you want to use.
- Specify identifiers for the spatial reference system that you want to
create.
- In the Name field, type a 1- to 64-character name for the
system.
Restriction: | Do not specify the name of another spatial reference system. No two
spatial reference systems in the database can have the same name.
|
- In the ID field, type a numerical identifier. It must be an
integer.
Restriction: | Do not specify the ID of another spatial reference system. No two
spatial reference systems in the database can have the same ID.
|
- Using a medium outside the Control Center--for
example, paper or a white board--determine the lowest negative
coordinates and measures that apply to the geographic features that you are
representing. For guidelines on how to do this, see Determining the lowest negative coordinates and measures.
- From the Create Spatial Reference window, specify
values to convert negative or decimal coordinates and measures into data items
that DB2 Spatial Extender supports--that is, into 32-bit non-negative
integers.
- Specify values to convert negative or decimal X coordinates into
non-negative integers:
-
Specify a false Y that will allow DB2 Spatial Extender to convert negative Y
coordinates into positive values. You do this in the Offset
column, in the field nearest to the Y:
- If any values within the range of Y coordinates that you identified in
step 4 are negative, type a false Y that, when subtracted from the
lowest negative coordinate, leaves a positive number. For guidelines,
see Specifying offset factors.
- If all the Y coordinates are positive, type a false Y of 0.
- If you are going to include Z coordinates in your spatial data, specify
values to convert negative or decimal Z coordinates into non-negative
integers:
-
In the Offset column, in the field nearest to the Z,
type a false Z:
- If any values within the range of Z coordinates that you identified in
step 4 are negative, type a false Z that, when subtracted from the
lowest negative coordinate, leaves a positive number. For guidelines,
see Specifying offset factors.
- If all the Z coordinates are non-negative, type a false Z of 0.
-
In the Scale factor column, specify a Z unit in the field to the
far right of the Z. This Z unit should be one that, when
multiplied by any decimal Z coordinate, yields a whole number that can be
stored as 32-bit data item, with minimum loss of precision. For
guidelines, see Specifying scale factors.
- If you are going to include measures in your spatial data, specify values
to convert negative or decimal measures into positive integers:
-
In the Offset column, in the field nearest to the Linear
label, type a false M:
- If any values within the range of measures that you identified in step 4 are negative, type a false M that, when subtracted from the
lowest negative measure, leaves a positive number. For guidelines, see Specifying offset factors.
- If all the measures are positive, type a false M of 0.
-
In the Scale factor column, specify an M unit in the field to the
far right of the Linear label. This M unit should be one
that, when multiplied by any decimal measure, yields a whole number that can
be stored as 32-bit data item, with minimum loss of precision. For
guidelines, see Specifying scale factors.
- Click OK to create the spatial reference system that you
want.
[ Top of Page | Previous Page | Next Page ]