inspectdb¶django.contrib.gis が INSTALLED_APPS に入っている場合、 inspectdb 管理コマンドは GeoDjango のコマンドでオーバーライドされます。オーバーライドされたコマンドは空間を認識し、自動生成されるモデル定義に適切なジオメトリフィールドを配置します。
ogrinspect¶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.
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.
デフォルトの FloatField の代わりに DecimalField を生成するには OGR float フィールドをカンマ区切りで指定します。すべての OGR float フィールドに適用するには true を設定します。
ジオメトリフィールドに使用するモデル属性名を指定します。デフォルトは 'geom' です。
OGR DataSource 内のどのレイヤーを使用するかを指定するキー。デフォルトは 0 (最初のレイヤー) です。 Layer の整数または文字列識別子として使用できます。データベースを調査する場合、 layer は通常、調査したいテーブル名です。
LayerMapping で使用するマッピング辞書を自動生成します。
ジオメトリフィールドを生成する際に、ジオメトリコレクションとして扱います。例えば、この設定が有効な場合、生成されるモデルには MultiPolygonField ではなく PolygonField が配置されます。
与えられたフィールド名を返す __str__() メソッドをモデルに生成します。
from django.contrib.gis.db import models のインポート文を抑制します。
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.
The SRID to use for the geometry field. If not set, ogrinspect attempts
to automatically determine of the SRID of the data source.
12月 03, 2025