diff --git a/lib/xmet/city.py b/lib/xmet/city.py index 41df9e8..16765df 100644 --- a/lib/xmet/city.py +++ b/lib/xmet/city.py @@ -64,13 +64,13 @@ class City(DatabaseTable): yield City.from_tsv_row(row) @staticmethod - def each_within_poly(db: Database, poly: shapely.Polygon): + def each_within_poly(db: Database, poly: shapely.Polygon, limit=None): st = db.query(City, [ 'ST_Within(location, GeomFromText(:poly, 4326)) = 1' ], { 'poly': shapely.to_wkt(poly) }, [ ('population', DatabaseOrder.DESC) - ]) + ], limit) yield from st.each()