kopia lustrzana https://github.com/OpenDroneMap/WebODM
Cogeo migration
rodzic
4ac4e9e3c4
commit
cff90587e3
|
@ -0,0 +1,34 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from app.cogeo import assure_cogeo
|
||||
from django.db import migrations
|
||||
import glob
|
||||
import os
|
||||
from webodm import settings
|
||||
|
||||
def find_and_assure_cogeo(apps, schema_editor):
|
||||
print("===============================================")
|
||||
print("Optimizing TIFFs: this is going to take a while!")
|
||||
print("===============================================")
|
||||
|
||||
for asset_filename in ["odm_orthophoto.tif", "dsm.tif", "dtm.tif"]:
|
||||
for asset in glob.glob(os.path.join(settings.MEDIA_ROOT, "**", asset_filename), recursive=True):
|
||||
try:
|
||||
print("Optimizing %s" % asset)
|
||||
assure_cogeo(asset)
|
||||
except Exception as e:
|
||||
print("WARNING: cannot check/optimize %s (%s), skipping..." % (asset, str(e)))
|
||||
|
||||
print("Done optimizing TIFFs!")
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('app', '0029_auto_20190907_1348'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(find_and_assure_cogeo),
|
||||
]
|
Ładowanie…
Reference in New Issue