GeoDjangoの管理コマンド¶
inspectdb¶
- django-admin inspectdb
django.contrib.gis が INSTALLED_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=Truekeyword option to the field definition. Set withtrueto 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=Truekeyword option to the field definition. Set withtrueto apply to all applicable fields.
- --srid SRID¶
The SRID to use for the geometry field. If not set,
ogrinspectattempts to automatically determine of the SRID of the data source.