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
blank=True
keyword option to the field definition. Set with true
to apply to all applicable fields.--decimal
DECIMAL
DecimalField
instead of the default FloatField
. Set to true
to apply to all OGR float fields.--geom-name
GEOM_NAME
'geom'
.--layer
LAYER_KEY
DataSource
source to use. Defaults to 0 (the first layer). May be an integer or a string identifier for the Layer
. When inspecting databases, layer
is generally the table name you want to inspect.--mapping
LayerMapping
.--multi-geom
MultiPolygonField
will be placed in the generated model rather than PolygonField
.--name-field
NAME_FIELD
__str__()
method on the model that returns the given field name.--no-imports
from django.contrib.gis.db import models
import statement.--null
NULL
null=True
keyword option to the field definition. Set with true
to apply to all applicable fields.--srid
SRID
ogrinspect
attempts to automatically determine of the SRID of the data source.