From c54b67edd6e72a315d9425db1cf20b6e7a9c3ceb Mon Sep 17 00:00:00 2001 From: Claudio Ortega Date: Fri, 10 Nov 2023 17:37:08 +0000 Subject: [PATCH] check if param is None --- urbanpy/download/download.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/urbanpy/download/download.py b/urbanpy/download/download.py index e8d03ae..b420db2 100644 --- a/urbanpy/download/download.py +++ b/urbanpy/download/download.py @@ -67,10 +67,10 @@ def nominatim_osm(query: str, expected_position: "int | None" = 0) -> GeoDataFra response = requests.get(osm_url, params=osm_parameters) all_results = response.json() gdf = gpd.GeoDataFrame.from_features(all_results["features"], crs="EPSG:4326") - if expected_position: - return gdf.iloc[expected_position : expected_position + 1] # this returns a GeoDataFrame instead of GeoSeries - - return gdf + if expected_position is None: + return gdf + + return gdf.iloc[expected_position : expected_position + 1] def overpass_pois(bounds, facilities=None, custom_query=None):