added gadm geo package dataset

This commit is contained in:
Sam
2021-02-11 11:25:56 +00:00
parent d577a6b202
commit 202a1b14f6
2 changed files with 5 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ import json
from django.core.management.base import BaseCommand
from django.contrib.gis.geos import GEOSGeometry, MultiPolygon
from django.contrib.gis.gdal import DataSource
from geo.models import City, Region, Province, Country
@@ -15,7 +16,7 @@ logging.basicConfig(
class Command(BaseCommand):
'help' = 'Load geographic dataset'
help = 'Load geographic dataset'
def handle(self, *args, **kwargs):
print('Deleting all instances of Country, Region, Province, City')
@@ -25,6 +26,9 @@ class Command(BaseCommand):
Region.objects.all().delete()
Country.objects.all().delete()
# load GADM data data source
ds = DataSource('datasets/gadm36_ESP.gpkg')
# create country for spain
country = Country.objects.create(name='España')