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¶
使用逗号分隔的 OGR 浮点字段列表来生成
DecimalField,而不是默认的FloatField。设置为true,以应用于所有 OGR 浮点字段。
- --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.