# Path: giscube/config.py
# MEDIA_ROOT = '{0}/giscube_app/static/'.format(current_dir)
# 
# MEDIA_URL = 'uploaded_files/'


import os
import shutil
import subprocess
from giscube.config import MEDIA_ROOT, MEDIA_URL

def create_gtif(gtif):
    UPLOADED_FILE_DIR = '{0}{1}'.format(MEDIA_ROOT, MEDIA_URL)
    gtif_path = UPLOADED_FILE_DIR + gtif
    gtif_folder = gtif.split(".tif")[0]
    string = "gdal2tiles.py {0} {1}".format(gtif_path, gtif_folder)

# Path: giscube/config.py
# MEDIA_ROOT = '{0}/giscube_app/static/'.format(current_dir)
# 
# MEDIA_URL = 'uploaded_files/'


# Path: giscube_app/scripts/gtif_to_tile.py
import os
import shutil
import subprocess
from giscube.config import MEDIA_ROOT, MEDIA_URL


def create_gtif(gtif):
    UPLOADED_FILE_DIR = '{0}{1}'.format(MEDIA_ROOT, MEDIA_URL)
    gtif_path = UPLOADED_FILE_DIR + gtif
    gtif_folder = gtif.split(".tif")[0]
    string = "gdal2tiles.py {0} {1}".format(gtif_path, gtif_folder)

    subprocess.Popen(["gdal2tiles.py","{0}".format(gtif_path),"{0}".format(gtif_folder)])