April 2018
Beginner to intermediate
440 pages
11h 36m
English
For the three other shapefiles with multipolygon geometry types, we'll pass the argument—multi to manage.py and ogrinspect. Using this option generates a MultiPolygon geometry column in the data model.
This command generates a data model from the US States shapefile:
C:\Projects\chapter12>python manage.py ogrinspect arenas\data\US_States.shp US_States \ --srid=4326 --mapping --multi
The output will look like this:
# This is an auto-generated Django model module created by ogrinspect.from django.contrib.gis.db import modelsclass US_States(models.Model): stfips = models.CharField(max_length=2) state = models.CharField(max_length=66) stpostal = models.CharField(max_length=2) version = models.CharField(max_length=2) dotregion = ...