GeoDjango 管理命令Link to this heading

inspectdbLink to this heading

django-admin inspectdb

django.contrib.gis 在您的 INSTALLED_APPS 中时,管理命令 inspectdb 会被 GeoDjango 中的命令所覆盖。覆盖后的命令具有空间感知功能,并在适当的情况下将几何字段放在自动生成的模型定义中。

ogrinspectLink to this heading

django-admin ogrinspect data_source model_nameLink to this definition

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 BLANKLink to this definition

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 DECIMALLink to this definition

使用逗号分隔的 OGR 浮点字段列表来生成 DecimalField,而不是默认的 FloatField。设置为 true,以应用于所有 OGR 浮点字段。

--geom-name GEOM_NAMELink to this definition

指定要用于几何字段的模型属性名称。默认为 'geom'

--layer LAYER_KEYLink to this definition

用于指定在 OGR DataSource 源中要使用的图层的键。默认为 0(第一个图层)。可以是整数或 Layer 的字符串标识符。在检查数据库时,通常 layer 是您要检查的表名。

--mappingLink to this definition

自动生成一个映射字典,用于与 LayerMapping 配合使用。

--multi-geomLink to this definition

在生成几何字段时,将其视为几何集合。例如,如果启用了此设置,则生成的模型中将放置一个 MultiPolygonField,而不是 PolygonField

--name-field NAME_FIELDLink to this definition

在模型上生成一个返回指定字段名称的 __str__() 方法。

--no-importsLink to this definition

抑制了 from django.contrib.gis.db import models 的导入语句。

--null NULLLink to this definition

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 SRIDLink to this definition

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