def populatepolygon(latlong_dict): """build a travelpolygon given a list of dicts containing the keys 'longitude' and 'latitude' latlong_dict -- list of dicts """ polygon = TravelPolygon() polygon.populate(latlong_dict) return polygon
def buildpolygon(latitude, longitude, max_minutes, precision=50): """estimate a polygon such that every point within the polygon is within max_minutes of the specified center (lat, long). precision defines the number of vertices to build the polygon latitude, longitude -- self explanatory max_minutes -- max travel time from the specified lat long precision[optional] -- number of points used to estimate the polygon returns: list of dicts containing final lat, long. order of points matter """ polygon = TravelPolygon() polygon.build(latitude, longitude, max_minutes, precision) polygon.fit() return polygon