---
title: "地理情報フィード"
version: 6.0
locale: ja
source: https://docs.djangoproject.com/ja/6.0/ref/contrib/gis/feeds/
canonical: https://djangodocs.dev/ja/6.0/ref/contrib/gis/feeds/
---
# 地理情報フィード

GeoDjango には独自の [`Feed`](#django.contrib.gis.feeds.Feed) サブクラスがあり、[Simple GeoRSS](https://www.ogc.org/standard/georss/) または [W3C Geo](https://www.w3.org/2003/01/geo/) 標準に従ってフォーマットされた RSS/Atom フィードに位置情報を埋め込むことができます。GeoDjango の syndication API は Django のスーパーセットなので、 [Django の配信フレームワークのドキュメント](/ja/6.0/ref/contrib/syndication/) を参照してください。

## カスタマイズ例

## API リファレンス

### `Feed` サブクラス

#### `class Feed`

[`django.contrib.syndication.views.Feed`](/ja/6.0/ref/contrib/syndication/#django.contrib.syndication.views.Feed) 基底クラスに提供されているメソッドに加えて、GeoDjango の `Feed` クラスは以下のオーバーライドを提供します。これらのオーバーライドは複数の方法で行うことができますので、その点に注意してください:

```
from django.contrib.gis.feeds import Feed

class MyFeed(Feed):
    # First, as a class attribute.
    geometry = ...
    item_geometry = ...

    # Also a function with no arguments
    def geometry(self): ...

    def item_geometry(self): ...

    # And as a function with a single argument
    def geometry(self, obj): ...

    def item_geometry(self, item): ...
```

#### `geometry(obj)`

`get_object()` で返されたオブジェクトを受け取り、 *feed* のジオメトリを返します。通常、これは `GEOSGeometry` インスタンスであり、ポイントまたはボックスを表すタプルであることもあります。例えば:

```
class ZipcodeFeed(Feed):
    def geometry(self, obj):
        # Can also return: `obj.poly`, and `obj.poly.centroid`.
        return obj.poly.extent  # tuple like: (X0, Y0, X1, Y1).
```

#### `item_geometry(item)`

これをセットすると、フィードの各 *アイテム* のジオメトリを返します。これは `GEOSGeometry` のインスタンス、 あるいは点座標やバウンディングボックスを表すタプルとなります。たとえば次のようになります:

```
class ZipcodeFeed(Feed):
    def item_geometry(self, obj):
        # Returns the polygon.
        return obj.poly
```

### `SyndicationFeed` サブクラス

以下の [`django.utils.feedgenerator.SyndicationFeed`](/ja/6.0/ref/utils/#django.utils.feedgenerator.SyndicationFeed) のサブクラスが利用可能です:

#### `class GeoRSSFeed`

#### `class GeoAtom1Feed`

#### `class W3CGeoFeed`

> **Note**
>
> [W3C Geo](https://www.w3.org/2003/01/geo/) フォーマットのフィードでは、[`PointField`](/ja/6.0/ref/contrib/gis/model-api/#django.contrib.gis.db.models.PointField) ジオメトリのみがサポートされています。
