---
title: "GeoDjango データベース API"
version: 5.0
locale: ja
source: https://docs.djangoproject.com/ja/5.0/ref/contrib/gis/db-api/
canonical: https://djangodocs.dev/ja/5.0/ref/contrib/gis/db-api/
---
# GeoDjango データベース API

## 空間バックエンド (Spatial Backend)

GeoDjango は現在、次の空間データベースバックエンドを提供しています:

- `django.contrib.gis.db.backends.postgis`
- `django.contrib.gis.db.backends.mysql`
- `django.contrib.gis.db.backends.oracle`
- `django.contrib.gis.db.backends.spatialite`

### MySQL の空間データに関する制限

Django は、最近の MySQL バージョンで利用可能な、実際のジオメトリを操作する空間関数をサポートしています。しかし、空間関数は PostGIS のような他のバックエンドほど豊富ではありません。

### ラスターのサポート

`RasterField` は現在、PostGIS バックエンドのみに実装されています。ラスターフィールドに対する空間ルックアップは可能ですが、空間データベース関数や集計は実装されていません。

## モデルを作成し、ジオメトリフィールドを保存する

以下にジオメトリオブジェクトの作成例を示します (`Zipcode` モデルを想定):

```pycon
>>> from zipcode.models import Zipcode
>>> z = Zipcode(code=77096, poly="POLYGON(( 10 10, 10 20, 20 20, 20 15, 10 10))")
>>> z.save()
```

[`GEOSGeometry`](/ja/5.0/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry) オブジェクトもジオメトリモデルを保存するために使用できます:

```pycon
>>> from django.contrib.gis.geos import GEOSGeometry
>>> poly = GEOSGeometry("POLYGON(( 10 10, 10 20, 20 20, 20 15, 10 10))")
>>> z = Zipcode(code=77096, poly=poly)
>>> z.save()
```

さらに、`GEOSGeometry` がフィールドの座標系と異なる座標系 (異なる SRID 値を持つ) 場合は、空間データベースの変換プロシージャを使用して、モデルのフィールドの SRID に暗黙的に変換されます:

```pycon
>>> poly_3084 = GEOSGeometry(
...     "POLYGON(( 10 10, 10 20, 20 20, 20 15, 10 10))", srid=3084
... )  # SRID 3084 is 'NAD83(HARN) / Texas Centric Lambert Conformal'
>>> z = Zipcode(code=78212, poly=poly_3084)
>>> z.save()
>>> from django.db import connection
>>> print(
...     connection.queries[-1]["sql"]
... )  # printing the last SQL statement executed (requires DEBUG=True)
INSERT INTO "geoapp_zipcode" ("code", "poly") VALUES (78212, ST_Transform(ST_GeomFromWKB('\\001 ... ', 3084), 4326))
```

そのため、ジオメトリパラメータは `GEOSGeometry` オブジェクト、WKT (Well Known Text [^1]) 、HEXEWKB (PostGIS 固有のジオメトリで、16 進数の WKB ジオメトリ [^2]) 、GeoJSON ([**RFC 7946**](https://datatracker.ietf.org/doc/html/rfc7946.html) 参照) を使用して渡すことができます。基本的に、入力が `GEOSGeometry` オブジェクトでない場合、ジオメトリフィールドは入力から `GEOSGeometry` インスタンスを作成しようとします。

[`GEOSGeometry`](/ja/5.0/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry) オブジェクトを作成する詳細については、[GEOS チュートリアル](/ja/5.0/ref/contrib/gis/geos/#geos-tutorial) を参照してください。

## ラスターフィールドを持つモデルの作成と保存

ラスターモデルを作成するとき、ラスターフィールドは、遅延評価を使用して、入力を [`GDALRaster`](/ja/5.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster) に暗黙的に変換します。そのため、ラスタフィールドは [`GDALRaster`](/ja/5.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster) コンストラクタが受け付けるすべての入力を受け入れます。

以下は、ラスターファイル `volcano.tif` からラスターオブジェクトを作成する方法の例です (`Elevation` モデルを想定) :

```pycon
>>> from elevation.models import Elevation
>>> dem = Elevation(name="Volcano", rast="/path/to/raster/volcano.tif")
>>> dem.save()
```

[`GDALRaster`](/ja/5.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster) オブジェクトもラスターモデルの保存に使用できます:

```pycon
>>> from django.contrib.gis.gdal import GDALRaster
>>> rast = GDALRaster(
...     {
...         "width": 10,
...         "height": 10,
...         "name": "Canyon",
...         "srid": 4326,
...         "scale": [0.1, -0.1],
...         "bands": [{"data": range(100)}],
...     }
... )
>>> dem = Elevation(name="Canyon", rast=rast)
>>> dem.save()
```

これは次と等価です:

```pycon
>>> dem = Elevation.objects.create(
...     name="Canyon",
...     rast={
...         "width": 10,
...         "height": 10,
...         "name": "Canyon",
...         "srid": 4326,
...         "scale": [0.1, -0.1],
...         "bands": [{"data": range(100)}],
...     },
... )
```

## 空間のルックアップ (Spatial Lookup)

GeoDjango のルックアップ型は `filter()` や `exclude()` などの manager メソッドで使うことができます。しかし、 GeoDjango 固有のルックアップ型は空間フィールドでのみ利用可能です。

「通常の」フィールド (例えば [`CharField`](/ja/5.0/ref/models/fields/#django.db.models.CharField)) のフィルタは、地理情報フィールドのフィルタと連結すできます。ジオメトリルックアップはジオメトリとラスタの両方の入力を受け付けます。

地理情報ルックアップの一般的な構造を以下に記載します。完全なリファレンスは、 [空間ルックアップのリファレンス](/ja/5.0/ref/contrib/gis/geoquerysets/#spatial-lookups) にあります。

### ジオメトリ・ルックアップ

地理情報クエリにおいて、ジオメトリを用いる一般的な形式は以下の通りです ([GeoDjango モデル API](/ja/5.0/ref/contrib/gis/model-api/) で使用されている `Zipcode` モデルを想定):

```text
>>> qs = Zipcode.objects.filter(<field>__<lookup_type>=<parameter>)
>>> qs = Zipcode.objects.exclude(...)
```

例:

```pycon
>>> qs = Zipcode.objects.filter(poly__contains=pnt)
>>> qs = Elevation.objects.filter(poly__contains=rst)
```

この場合、 `poly` は地理情報フィールド、 [`contains`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-gis-contains) は空間ルックアップタイプ、 `pnt` はパラメータ ([`GEOSGeometry`](/ja/5.0/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry) オブジェクト、または GeoJSON、WKT、HEXEWKB の文字列)、そして `rst` は [`GDALRaster`](/ja/5.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster) オブジェクトです。

### ラスター・ルックアップ

ラスタールックアップの構文はジオメトリの構文に似ています。唯一の違いは、バンドインデックスを追加入力として指定できることです。バンドインデックスが指定されていない場合は、デフォルトで最初のバンドが使用されます (インデックス"`0`") 。その場合、構文はジオメトリルックアップの構文と同一です。

バンドインデックスを指定するには、ルックアップに追加のパラメータを両側で指定できます。左側では、バンドインデックスを渡すためにダブルアンダースコア構文が使用されます。右側では、ラスターとバンドのインデックスのタプルを指定できます。

これにより、ラスターを使用するルックアップの一般的な形式が得られます ([GeoDjango モデル API](/ja/5.0/ref/contrib/gis/model-api/) で使用されている `Elevation` モデルを想定):

```text
>>> qs = Elevation.objects.filter(<field>__<lookup_type>=<parameter>)
>>> qs = Elevation.objects.filter(<field>__<band_index>__<lookup_type>=<parameter>)
>>> qs = Elevation.objects.filter(<field>__<lookup_type>=(<raster_input, <band_index>)
```

例:

```pycon
>>> qs = Elevation.objects.filter(rast__contains=geom)
>>> qs = Elevation.objects.filter(rast__contains=rst)
>>> qs = Elevation.objects.filter(rast__1__contains=geom)
>>> qs = Elevation.objects.filter(rast__contains=(rst, 1))
>>> qs = Elevation.objects.filter(rast__1__contains=(rst, 1))
```

例の左辺では、 `rast` が地理情報ラスタフィールドで、 [`contains`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-gis-contains) が空間ルックアップタイプです。右辺の `geom` はジオメトリ入力で、 `rst` は [`GDALRaster`](/ja/5.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster) オブジェクトです。バンドインデックスは最初の2つのクエリではデフォルトで `0` に設定され、他のクエリでは `1` に設定されます。

すべての空間ルックアップはラスターオブジェクトの両側で使用できますが、すべての基本演算子がラスター入力をネイティブに受け付けるわけではありません。演算子がジオメトリ入力を想定している場合、ラスタは自動的にジオメトリに変換されます。ルックアップ結果を解釈する際には、この点に留意することが重要です。

ラスターをサポートするタイプは [互換表](#spatial-lookup-compatibility) のすべてのルックアップにリストされています。ラスタを含むルックアップは現在のところ PostGIS バックエンドでのみ利用可能です。

## 距離クエリ

### はじめに

残念ながら、地球は平らではないため、空間データでの距離計算は厄介です。PostGIS の制限により、地理座標系のフィールドを使用した距離のクエリは、別の方法で表現しなければならない場合があります。詳細は [GeoDjango モデル API](/ja/5.0/ref/contrib/gis/model-api/)  ドキュメントの [SRID の選択](/ja/5.0/ref/contrib/gis/model-api/#selecting-an-srid) セクションを参照してください。

### 距離ルックアップ

*利用可能なDB*: PostGIS、MariaDB、MySQL、Oracle、SpatiaLite、PGRaster (ネイティブ)

以下の距離ルックアップが利用できます:

- [`distance_lt`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_lt)
- [`distance_lte`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_lte)
- [`distance_gt`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_gt)
- [`distance_gte`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_gte)
- [`dwithin`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-dwithin) (MariaDB and MySQL を除く)

> **Note**
>
> 距離をクエリするのではなく、 *計測* する場合は [`Distance`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Distance) 関数を使います。

距離ルックアップは、次のように構成されるタプルパラメータを受け取ります:

1. 計算のベースとなるジオメトリまたはラスター。
2. 距離を含む数字または [`Distance`](/ja/5.0/ref/contrib/gis/measure/#django.contrib.gis.measure.Distance) オブジェクト。

[`Distance`](/ja/5.0/ref/contrib/gis/measure/#django.contrib.gis.measure.Distance) オブジェクトが使用されている場合、任意の単位で表現される可能性があります(SQL 生成時には、フィールドの単位に変換された単位が使用される)。それ以外の場合、数値パラメータはフィールドの単位であると想定されます。

> **Note**
>
> PostGIS では、`ST_Distance_Sphere` は、地理距離クエリを実行するジオメトリタイプを制限しません。 [^3] ただし、これらのクエリには、 *全て* の行のたびに大圏距離を動的に計算する必要があるため、長い時間がかかる可能性があります。これは従来のジオメトリフィールドに空間インデックスが使用できないためです。
>
> WGS84 の距離クエリでより良いパフォーマンスを得るには、代わりにデータベースで [ジオグラフィカラム](/ja/5.0/ref/contrib/gis/model-api/#geography-type) を使うことを検討してください。フィールド定義で `geography=True` と設定することで、 GeoDjango にジオグラフィカラムを使うように指示できます。

例えば、`SouthTexasCity` というモデル ([GeoDjango 距離テスト](https://github.com/django/django/blob/stable/5.0.x/tests/gis_tests/distapp/models.py) から) が、テキサス州南部の都市に有効な *投影* 座標系にあるとします:

```
from django.contrib.gis.db import models

class SouthTexasCity(models.Model):
    name = models.CharField(max_length=30)
    # A projected coordinate system (only valid for South Texas!)
    # is used, units are in meters.
    point = models.PointField(srid=32140)
```

距離クエリは次のように実行できます:

```pycon
>>> from django.contrib.gis.geos import GEOSGeometry
>>> from django.contrib.gis.measure import D  # ``D`` is a shortcut for ``Distance``
>>> from geoapp.models import SouthTexasCity
# Distances will be calculated from this point, which does not have to be projected.
>>> pnt = GEOSGeometry("POINT(-96.876369 29.905320)", srid=4326)
# If numeric parameter, units of field (meters in this case) are assumed.
>>> qs = SouthTexasCity.objects.filter(point__distance_lte=(pnt, 7000))
# Find all Cities within 7 km, > 20 miles away, and > 100 chains away (an obscure unit)
>>> qs = SouthTexasCity.objects.filter(point__distance_lte=(pnt, D(km=7)))
>>> qs = SouthTexasCity.objects.filter(point__distance_gte=(pnt, D(mi=20)))
>>> qs = SouthTexasCity.objects.filter(point__distance_gte=(pnt, D(chain=100)))
```

ラスタークエリは、ジオメトリフィールド "point" をラスターフィールドに置き換えるか、"pnt" オブジェクトをラスターオブジェクトに置き換えるか、またはその両方で同じように機能します。右辺のラスター入力のバンドインデックスを指定するには、3値のタプルをルックアップに渡すことができます:

```pycon
>>> qs = SouthTexasCity.objects.filter(point__distance_gte=(rst, 2, D(km=7)))
```

ラスター `rst` のバンドのうち、インデックス2 (3番目のバンド) がルックアップに使用されます。

## 互換表

### 空間のルックアップ (Spatial Lookup)

以下の表は、各空間データベースバックエンドで利用可能な空間ルックアップの概要です。PostGIS Raster (PGRaster) のルックアップは [ラスタールックアップの詳細](#spatial-lookup-raster) に記載されている3つのカテゴリに分類されます: ネイティブサポート `N`、双方向ネイティブサポート `B`、ジオメトリ変換サポート `C`。

| ルックアップタイプ | PostGIS | Oracle | MariaDB | MySQL [^4] | SpatiaLite | PGRaster |
| --- | --- | --- | --- | --- | --- | --- |
| [`bbcontains`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-bbcontains) | X |  | X | X | X | N |
| [`bboverlaps`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-bboverlaps) | X |  | X | X | X | N |
| [`contained`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-contained) | X |  | X | X | X | N |
| [`contains`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-gis-contains) | X | X | X | X | X | B |
| [`contains_properly`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-contains_properly) | X |  |  |  |  | B |
| [`coveredby`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-coveredby) | X | X |  |  | X | B |
| [`covers`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-covers) | X | X |  |  | X | B |
| [`crosses`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-crosses) | X |  | X | X | X | C |
| [`disjoint`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-disjoint) | X | X | X | X | X | B |
| [`distance_gt`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_gt) | X | X | X | X | X | N |
| [`distance_gte`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_gte) | X | X | X | X | X | N |
| [`distance_lt`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_lt) | X | X | X | X | X | N |
| [`distance_lte`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-distance_lte) | X | X | X | X | X | N |
| [`dwithin`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-dwithin) | X | X |  |  | X | B |
| [`equals`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-equals) | X | X | X | X | X | C |
| [`exact`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-same_as) | X | X | X | X | X | B |
| [`intersects`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-intersects) | X | X | X | X | X | B |
| [`isempty`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-isempty) | X |  |  |  |  |  |
| [`isvalid`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-isvalid) | X | X |  | X | X |  |
| [`overlaps`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-overlaps) | X | X | X | X | X | B |
| [`relate`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-relate) | X | X | X |  | X | C |
| [`same_as`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-same_as) | X | X | X | X | X | B |
| [`touches`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-touches) | X | X | X | X | X | B |
| [`within`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-within) | X | X | X | X | X | B |
| [`left`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-left) | X |  |  |  |  | C |
| [`right`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-right) | X |  |  |  |  | C |
| [`overlaps_left`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-overlaps_left) | X |  |  |  |  | B |
| [`overlaps_right`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-overlaps_right) | X |  |  |  |  | B |
| [`overlaps_above`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-overlaps_above) | X |  |  |  |  | C |
| [`overlaps_below`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-overlaps_below) | X |  |  |  |  | C |
| [`strictly_above`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-strictly_above) | X |  |  |  |  | C |
| [`strictly_below`](/ja/5.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-strictly_below) | X |  |  |  |  | C |

### データベース関数

次の表は、各空間バックエンドで使用できるジオグラフィ固有のデータベース関数の概要です。

| 関数 | PostGIS | Oracle | MariaDB | MySQL | SpatiaLite |
| --- | --- | --- | --- | --- | --- |
| [`Area`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Area) | X | X | X | X | X |
| [`AsGeoJSON`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsGeoJSON) | X | X | X | X | X |
| [`AsGML`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsGML) | X | X |  |  | X |
| [`AsKML`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsKML) | X |  |  |  | X |
| [`AsSVG`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsSVG) | X |  |  |  | X |
| [`AsWKB`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsWKB) | X | X | X | X | X |
| [`AsWKT`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsWKT) | X | X | X | X | X |
| [`Azimuth`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Azimuth) | X |  |  |  | X (LWGEOM/RTTOPO) |
| [`BoundingCircle`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.BoundingCircle) | X | X |  |  |  |
| [`Centroid`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Centroid) | X | X | X | X | X |
| [`ClosestPoint`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.ClosestPoint) | X |  |  |  | X |
| [`Difference`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Difference) | X | X | X | X | X |
| [`Distance`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Distance) | X | X | X | X | X |
| [`Envelope`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Envelope) | X | X | X | X | X |
| [`ForcePolygonCW`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.ForcePolygonCW) | X |  |  |  | X |
| [`FromWKB`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.FromWKB) | X | X | X | X | X |
| [`FromWKT`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.FromWKT) | X | X | X | X | X |
| [`GeoHash`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.GeoHash) | X |  |  | X | X (LWGEOM/RTTOPO) |
| [`Intersection`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Intersection) | X | X | X | X | X |
| [`IsEmpty`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.IsEmpty) | X |  |  |  |  |
| [`IsValid`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.IsValid) | X | X |  | X | X |
| [`Length`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Length) | X | X | X | X | X |
| [`LineLocatePoint`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.LineLocatePoint) | X |  |  |  | X |
| [`MakeValid`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.MakeValid) | X |  |  |  | X (LWGEOM/RTTOPO) |
| [`MemSize`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.MemSize) | X |  |  |  |  |
| [`NumGeometries`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.NumGeometries) | X | X | X | X | X |
| [`NumPoints`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.NumPoints) | X | X | X | X | X |
| [`Perimeter`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Perimeter) | X | X |  |  | X |
| [`PointOnSurface`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.PointOnSurface) | X | X | X |  | X |
| [`Reverse`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Reverse) | X | X |  |  | X |
| [`Scale`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Scale) | X |  |  |  | X |
| [`SnapToGrid`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.SnapToGrid) | X |  |  |  | X |
| [`SymDifference`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.SymDifference) | X | X | X | X | X |
| [`Transform`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Transform) | X | X |  |  | X |
| [`Translate`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Translate) | X |  |  |  | X |
| [`Union`](/ja/5.0/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Union) | X | X | X | X | X |

### 集計関数

次の表は、各空間バックエンドで使用できる GIS 固有の集計関数の概要です。MySQL はこれらの集計関数をサポートしていないため、表から除外されていることに注意してください。

| 集計関数 | PostGIS | Oracle | SpatiaLite |
| --- | --- | --- | --- |
| [`Collect`](/ja/5.0/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.Collect) | X |  | X |
| [`Extent`](/ja/5.0/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.Extent) | X | X | X |
| [`Extent3D`](/ja/5.0/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.Extent3D) | X |  |  |
| [`MakeLine`](/ja/5.0/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.MakeLine) | X |  | X |
| [`Union`](/ja/5.0/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.Union) | X | X | X |

**脚注**

[^1]: *参照* Open Geospatial Consortium, Inc. の [OpenGIS Simple Feature Specification For SQL](https://portal.ogc.org/files/?artifact_id=829) 、ドキュメント 99-049 (May 5, 1999), at Ch. 3.2.5, p. 3-11 (SQL Textual Representation of Geometry) 。

[^2]: *参照* [PostGIS EWKB, EWKT and Canonical Forms](https://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT), PostGIS documentation at Ch. 4.1.2.

[^3]: *参照* [PostGIS documentation](https://postgis.net/docs/ST_DistanceSphere.html) の `ST_DistanceSphere` を参照してください。

[^4]: 詳細は [MySQL の空間データに関する制限](#mysql-spatial-limitations) セクションを参照してください。
