地理データ型

Geometric types represent two-dimensional spatial objects. The most fundamental type, the point, forms the basis for all of the other types.

地理データ型は2次元空間オブジェクトを表現します。 もっとも主要な型は point で、他のすべての型の基本になります。

Table 3-18. Postgres 地理データ型

地理データ型記憶領域表現方法説明
point16 bytes(x,y)空間における座標点
line32 bytes((x1,y1),(x2,y2))無限の直線
lseg32 bytes((x1,y1),(x2,y2))有限の線分
box32 bytes((x1,y1),(x2,y2))矩形
path4+32n bytes((x1,y1),...)閉じたパス (多角形に似ている)
path4+32n bytes[(x1,y1),...]開いているパス
polygon4+32n bytes((x1,y1),...)多角形 (閉じたパスに似ている)
circle24 bytes<(x,y),r>円 (中心点と半径)

A rich set of functions and operators is available to perform various geometric operations such as scaling, translation, rotation, and determining intersections.

拡大/縮小、変換、回転、交点算出などのいろいろな座標操作をする ために、多くの機能や演算子の組み合わせが使用できます。

座標点 (Point)

Points are the fundamental two-dimensional building block for geometric types.

座標 (Point) は地理データ型の基礎となる2次元構成要素です。

point is specified using the following syntax:

point 型の書式設定です:


( x , y ) 
  x , y
where
    x is the x-axis coordinate as a floating point number
    y is the y-axis coordinate as a floating point number
( x , y ) 
あるいは
  x , y
ここで
    x は X 座標値 (浮動小数点)
    y は Y 座標値 (浮動小数点)

線分 (lseg)

Line segments (lseg) are represented by pairs of points.

線分 (lseg:Line Segment) は1組の座標点で表現されます。

lseg is specified using the following syntax:

lseg 型は、以下の書式で設定します:


( ( x1 , y1 ) , ( x2 , y2 ) )
  ( x1 , y1 ) , ( x2 , y2 )  
    x1 , y1   ,   x2 , y2    
where
    (x1,y1) and (x2,y2) are the endpoints of the segment
( ( x1 , y1 ) , ( x2 , y2 ) )
  ( x1 , y1 ) , ( x2 , y2 )  
    x1 , y1   ,   x2 , y2    
ここで
    (x1,y1) および (x2,y2) は線分の終端

矩形 (Box)

Boxes are represented by pairs of points which are opposite corners of the box.

矩形は、対角線上の角(かど)を表す一組の座標点 (point) で 表現されます。

box is specified using the following syntax:

box 型は、以下の書式で指定します:


( ( x1 , y1 ) , ( x2 , y2 ) )
  ( x1 , y1 ) , ( x2 , y2 )  
    x1 , y1   ,   x2 , y2    
where
    (x1,y1) and (x2,y2) are opposite corners
( ( x1 , y1 ) , ( x2 , y2 ) )
  ( x1 , y1 ) , ( x2 , y2 )  
    x1 , y1   ,   x2 , y2    
ここで
    (x1,y1) および (x2,y2) は対角線上の角
Boxes are output using the first syntax. The corners are reordered on input to store the lower left corner first and the upper right corner last. Other corners of the box can be entered, but the lower left and upper right corners are determined from the input and stored. 矩形は上記一番上の書式で出力されます。 2 つの角は、左下の角を最初に、右上の角を最後に格納するように 並べ替えられます.矩形の中の他の角を入力することもできますが、 入力から左下と右上の角が決定され、格納されます.

パス (Path)

Paths are represented by connected sets of points. Paths can be "open", where the first and last points in the set are not connected, and "closed", where the first and last point are connected. Functions popen(p) and pclose(p) are supplied to force a path to be open or closed, and functions isopen(p) and isclosed(p) are supplied to select either type in a query.

Path は接続した座標点のセットにより表現されます.パスは、 最初の点と最後の点が接続されていない「開いた」状態か、最初の点と 最後の点が接続されている「閉じた」状態かのいずれかです. あるパスを強制的に開いた/閉じた状態にする popen(p)pclose(p) が提供されており、また isopen(p)isclosed(p) を使うと、問い合わせの中でいずれかのタイプを 選択することができます.

path is specified using the following syntax:

path 型は以下のような書式で指定します:


( ( x1 , y1 ) , ... , ( xn , yn ) )
[ ( x1 , y1 ) , ... , ( xn , yn ) ]
  ( x1 , y1 ) , ... , ( xn , yn )  
  ( x1 , y1   , ... ,   xn , yn )  
    x1 , y1   , ... ,   xn , yn    
where
    (x1,y1),...,(xn,yn) are points 1 through n
    a leading "[" indicates an open path
    a leading "(" indicates a closed path
( ( x1 , y1 ) , ... , ( xn , yn ) )
[ ( x1 , y1 ) , ... , ( xn , yn ) ]
  ( x1 , y1 ) , ... , ( xn , yn )  
  ( x1 , y1   , ... ,   xn , yn )  
    x1 , y1   , ... ,   xn , yn    
ここで、
    (x1,y1),...,(xn,yn) は 1 から n までの座標点
    "[" で始まるのは開いたパス
    "(" で始まるのは閉じたパス
Paths are output using the first syntax. Note that Postgres versions prior to v6.1 used a format for paths which had a single leading parenthesis, a "closed" flag, an integer count of the number of points, then the list of points followed by a closing parenthesis. The built-in function upgradepath is supplied to convert paths dumped and reloaded from pre-v6.1 databases. path は最初の書式で出力されます。 Postgres の v6.1 より前のバージョン では、path の書式として、 "(" で始まる「閉じていること」を示す フラグ、座標点の数を表す 1 つの整数カウンタ、座標点のリスト、 最後に閉じ括弧 ")" という形式を使用していました。 v6.1 以前のデータベースからダンプおよびリロードされた path を 変換するために、組み込み関数 upgradepath を使用することができます。

多角形 (Polygon)

Polygons are represented by sets of points. Polygons should probably be considered equivalent to closed paths, but are stored differently and have their own set of support routines.

多角形は座標点のセットで表現されます。これは、"閉じたパス"と 同じであると考えられますが、異なった方法で格納され、また 双方とも別々のサポートルーチンセットを持っています.

polygon is specified using the following syntax:

polygon 型は、以下の書式で指定します:


( ( x1 , y1 ) , ... , ( xn , yn ) )
  ( x1 , y1 ) , ... , ( xn , yn )  
  ( x1 , y1   , ... ,   xn , yn )  
    x1 , y1   , ... ,   xn , yn    
where
    (x1,y1),...,(xn,yn) are points 1 through n
( ( x1 , y1 ) , ... , ( xn , yn ) )
  ( x1 , y1 ) , ... , ( xn , yn )  
  ( x1 , y1   , ... ,   xn , yn )  
    x1 , y1   , ... ,   xn , yn    
ここで、
    (x1,y1),...,(xn,yn) は 1 から n までの座標点
Polygons are output using the first syntax. Note that Postgres versions prior to v6.1 used a format for polygons which had a single leading parenthesis, the list of x-axis coordinates, the list of y-axis coordinates, followed by a closing parenthesis. The built-in function upgradepoly is supplied to convert polygons dumped and reloaded from pre-v6.1 databases. 多角形は、最初の書式で出力されます。 Postgres の v6.1 以前のバージョン では、polygonの書式として、"(" 、X 座標のリスト、Y 座標のリスト、 最後に閉じ括弧 ")" という形式を使用していました. v6.1 以前のデータベースからダンプおよびリロードされた多角形を 変換するために、組み込み関数 upgradepoly を使用することができます.

円 (Circle)

Circles are represented by a center point and a radius.

円 (circle) は、中心点座標と半径によって表現されます。

circle is specified using the following syntax:

circle 型は以下の書式で指定します:


< ( x , y ) , r >
( ( x , y ) , r )
  ( x , y ) , r  
    x , y   , r  
where
    (x,y) is the center of the circle
    r is the radius of the circle
< ( x , y ) , r >
( ( x , y ) , r )
  ( x , y ) , r  
    x , y   , r  
ここで、
    (x,y) は円の中心座標
    r は円の半径
Circles are output using the first syntax. 円は一番上の書式で出力されます