added gadm geo package dataset
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
BIN
datasets/gadm36_ESP.gpkg
Normal file
BIN
datasets/gadm36_ESP.gpkg
Normal file
Binary file not shown.
Reference in New Issue
Block a user