Created
June 2, 2016 18:50
-
-
Save plablo09/de671a93027137a3632d803d962545a1 to your computer and use it in GitHub Desktop.
Extract all shapes and import them to postgis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import glob | |
import os | |
import zipfile | |
print 'hey' | |
w_dir = '/home/plablo/tmp_data/' | |
files = glob.glob(w_dir + '*.zip') | |
d_2015 = [] | |
d_2016 = [] | |
for f in files: | |
if len(f.split('.')[0].split('_')) == 4: | |
d_2015.append(f) | |
z_file = zipfile.ZipFile(f) | |
#print os.path.split(f)[1] | |
for name in z_file.namelist(): | |
(dirname,filename) = os.path.split(name) | |
z_file.extract(name,w_dir + '/shapes_2015/') | |
else: | |
d_2016.append(f) | |
d_2015.append(f) | |
z_file = zipfile.ZipFile(f) | |
#print os.path.split(f)[1] | |
for name in z_file.namelist(): | |
(dirname,filename) = os.path.split(name) | |
z_file.extract(name,w_dir + '/shapes_2016/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment