GeoDjango Management CommandsLink to this heading
inspectdbLink to this heading
- 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.
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=Truekeyword option to the field definition. Set withtrueto apply to all applicable fields.
- --decimal DECIMALLink to this definition
Use a comma separated list of OGR float fields to generate
DecimalFieldinstead of the defaultFloatField. Set totrueto apply to all OGR float fields.
- --geom-name GEOM_NAMELink to this definition
Specifies the model attribute name to use for the geometry field. Defaults to
'geom'.
- --layer LAYER_KEYLink to this definition
The key for specifying which layer in the OGR
DataSourcesource to use. Defaults to 0 (the first layer). May be an integer or a string identifier for theLayer. When inspecting databases,layeris generally the table name you want to inspect.
- --mappingLink to this definition
Automatically generate a mapping dictionary for use with
LayerMapping.
- --multi-geomLink to this definition
When generating the geometry field, treat it as a geometry collection. For example, if this setting is enabled then a
MultiPolygonFieldwill be placed in the generated model rather thanPolygonField.
- --name-field NAME_FIELDLink to this definition
Generates a
__str__()method on the model that returns the given field name.
- --no-importsLink to this definition
Suppresses the
from django.contrib.gis.db import modelsimport statement.
- --null NULLLink to this definition
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 SRIDLink to this definition
The SRID to use for the geometry field. If not set,
ogrinspectattempts to automatically determine of the SRID of the data source.