#!/usr/bin/python # Basically, add '../src' to our path. import sys, os, site site.addsitedir(os.path.dirname(os.path.abspath(sys.argv[0])) + '/../src') import ExitCodes, GPS, SummaryFile1 # Find the average population density of a set of GPS coordinates # given a (SF1) geographic header file. if (len(sys.argv) < 4): print "Usage: %s " % sys.argv[0] raise SystemExit(ExitCodes.NotEnoughArgs) # If we made it here, it's sort of safe to parse the arguments # and hope they're in order. coords = GPS.Coordinates() coords.latitude = float(sys.argv[1]) coords.longitude = float(sys.argv[2]) geo_file_path = sys.argv[3] avg_density = SummaryFile1.FindAveragePopulationDensity(coords, geo_file_path) print str(avg_density)