GeoDjango Management CommandsΒΆ
inspectdb
ΒΆ
- django-admin inspectdb
When django.contrib.gis
is in your INSTALLED_APPS
, the
inspectdb
management command is overridden with one from GeoDjango.
The overridden command is spatially-aware, and places geometry fields in the
auto-generated model definition, where appropriate.
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 withtrue
to apply to all applicable fields.
- --decimal DECIMALΒΆ
Use a comma separated list of OGR float fields to generate
DecimalField
instead of the defaultFloatField
. Set totrue
to apply to all OGR float fields.
- --geom-name GEOM_NAMEΒΆ
Specifies the model attribute name to use for the geometry field. Defaults to
'geom'
.
- --layer LAYER_KEYΒΆ
The key for specifying which layer in the OGR
DataSource
source to use. Defaults to 0 (the first layer). May be an integer or a string identifier for theLayer
. When inspecting databases,layer
is generally the table name you want to inspect.
- --mappingΒΆ
Automatically generate a mapping dictionary for use with
LayerMapping
.
- --multi-geomΒΆ
When generating the geometry field, treat it as a geometry collection. For example, if this setting is enabled then a
MultiPolygonField
will be placed in the generated model rather thanPolygonField
.
- --name-field NAME_FIELDΒΆ
Generates a
__str__()
method on the model that returns the given field name.
- --no-importsΒΆ
Suppresses the
from django.contrib.gis.db import models
import statement.
- --null NULLΒΆ
Use a comma separated list of OGR field names to add the
null=True
keyword option to the field definition. Set withtrue
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.