GeoDjangoの管理コマンド

inspectdb

django-admin inspectdb

django.contrib.gisINSTALLED_APPS に入っている場合、 inspectdb 管理コマンドは GeoDjango のコマンドでオーバーライドされます。オーバーライドされたコマンドは空間を認識し、自動生成されるモデル定義に適切なジオメトリフィールドを配置します。

ogrinspect

django-admin ogrinspect data_source model_name

The ogrinspect management command will inspect the given OGR-compatible DataSource (e.g., a shapefile) and will output a GeoDjango model with the given model name. There's a detailed example of using ogrinspect in the tutorial.

--blank BLANK

Use a comma separated list of OGR field names to add the blank=True keyword option to the field definition. Set with true to apply to all applicable fields.

--decimal DECIMAL

デフォルトの FloatField の代わりに DecimalField を生成するには OGR float フィールドをカンマ区切りで指定します。すべての OGR float フィールドに適用するには true を設定します。

--geom-name GEOM_NAME

ジオメトリフィールドに使用するモデル属性名を指定します。デフォルトは 'geom' です。

--layer LAYER_KEY

OGR DataSource 内のどのレイヤーを使用するかを指定するキー。デフォルトは 0 (最初のレイヤー) です。 Layer の整数または文字列識別子として使用できます。データベースを調査する場合、 layer は通常、調査したいテーブル名です。

--mapping

LayerMapping で使用するマッピング辞書を自動生成します。

--multi-geom

ジオメトリフィールドを生成する際に、ジオメトリコレクションとして扱います。例えば、この設定が有効な場合、生成されるモデルには MultiPolygonField ではなく PolygonField が配置されます。

--name-field NAME_FIELD

与えられたフィールド名を返す __str__() メソッドをモデルに生成します。

--no-imports

from django.contrib.gis.db import models のインポート文を抑制します。

--null NULL

Use a comma separated list of OGR field names to add the null=True keyword option to the field definition. Set with true to apply to all applicable fields.

--srid SRID

The SRID to use for the geometry field. If not set, ogrinspect attempts to automatically determine of the SRID of the data source.