Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Created December 7, 2012 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/4236517 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/4236517 to your computer and use it in GitHub Desktop.
grab all the new footprint shapefiles
import urllib,os,zipfile,glob
base = "http://wsgw.mass.gov/data/gispub/shape/structures/structures_poly_"
def download():
for i in range(1,352):
i=str(i)
n = i+".zip"
b=base+n
urllib.urlretrieve(b,n)
print "downloaded " + i
st=os.stat(n)
if st.st_size>0:
print "about to extract"
z=zipfile.ZipFile(n,"r")
zl=z.namelist()
z.extractall()
print "extracted"
z.close()
print "cleaning up"
os.remove(n)
if __name__ == "__main__":
download()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment