Skip to content

Instantly share code, notes, and snippets.

@gka
gka / zip2nuts.py
Created December 13, 2011 23:37
This script tries to map European zip codes to NUTS2 regions by point-in-polygon checking the zip coordinate against a shapefile of NUTS regions..
#!/usr/bin/env python2.7
import csv, shapefile, Polygon, Polygon.IO, math
# shapefile comes from here:
# http://epp.eurostat.ec.europa.eu/cache/GISCO/geodatafiles/NUTS_10M_2006_SH.zip
shpsrc = "eu-nuts-2.shp"
# zip code database comes from here:
# http://www.clearlyandsimply.com/files/2010/10/european_cities_and_postcodes_us_standard.zip