Last active
January 24, 2022 18:46
-
-
Save johnjreiser/4645434 to your computer and use it in GitHub Desktop.
Script to download the GIS parcel and MOD-IV tax assessor databases from NJGIN, the State of New Jersey's online data and metadata repository. Essex and Middlesex are currently in "draft" form and are available through a separate download on NJGIN.
This file contains hidden or 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
import urllib, os, sys, zipfile | |
def download(url,name=""): | |
if(name == ""): | |
name = url.split('/')[-1] | |
webFile = urllib.urlopen(url) | |
localFile = open(name, 'w') | |
fname = localFile.name | |
localFile.write(webFile.read()) | |
webFile.close() | |
localFile.close() | |
return fname | |
baseurls = {'parcels': r"http://njgin.state.nj.us/download2/parcels/parcels_mdb_{COUNTY}.zip", 'taxlist': "http://njgin.state.nj.us/download2/parcels/parcels_taxlistsearch_{COUNTY}.zip"} | |
counties = ["Atlantic", "Bergen", "Burlington", "Camden", "CapeMay", "Cumberland", "Gloucester", "Hudson", "Hunterdon", "Mercer", "Monmouth", "Morris", "Ocean", "Passaic", "Salem", "Somerset", "Sussex", "Union", "Warren"] | |
for dt in baseurls.keys(): | |
for county in counties: | |
url = baseurls[dt].replace("{COUNTY}", county) | |
fn = url.split('/')[-1] | |
if(os.path.exists(fn)): | |
print county, dt, "zip file already downloaded." | |
else: | |
fn = download(url) | |
print county, "downloaded." | |
zipf = zipfile.ZipFile(fn, "r") | |
names = zipf.namelist() | |
if(len(names)==1): | |
if(not os.path.exists(dt+names[0])): | |
outz = open(dt+names[0], "wb") | |
outz.write(zipf.read(names[0])) | |
outz.close() | |
print county, dt, "extracted." | |
else: | |
print dt+names[0], "already exists. Skipped." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks John! I was also directed to shapefiles + tax lists for Essex here (maybe a new URL scheme for these?)
https://njgin.state.nj.us/download2/parcels_shp_Essex.zip
https://njgin.state.nj.us/download2/parcels/parcels_taxlist_Essex.zip
Still not sure about the "draft" state about these, they might still not be 100% complete / official yet.