99from shapely .geometry import shape
1010from vt2geojson import tools as vt2geojson_tools
1111
12- from mapswipe_workers .definitions import MAPILLARY_API_KEY , MAPILLARY_API_LINK , logger
12+ from mapswipe_workers .definitions import (
13+ MAPILLARY_API_KEY ,
14+ MAPILLARY_API_LINK ,
15+ CustomError ,
16+ logger ,
17+ )
1318from mapswipe_workers .utils .spatial_sampling import spatial_sampling
1419
1520
@@ -177,28 +182,24 @@ def filter_results(
177182 df = results_df .copy ()
178183 if creator_id is not None :
179184 if df ["creator_id" ].isna ().all ():
180- logger .exception (
181- "No Mapillary Feature in the AoI has a 'creator_id' value."
182- )
185+ logger .info ("No Mapillary Feature in the AoI has a 'creator_id' value." )
183186 return None
184187 df = df [df ["creator_id" ] == creator_id ]
185188 if is_pano is not None :
186189 if df ["is_pano" ].isna ().all ():
187- logger .exception ("No Mapillary Feature in the AoI has a 'is_pano' value." )
190+ logger .info ("No Mapillary Feature in the AoI has a 'is_pano' value." )
188191 return None
189192 df = df [df ["is_pano" ] == is_pano ]
190193 if organization_id is not None :
191194 if df ["organization_id" ].isna ().all ():
192- logger .exception (
195+ logger .info (
193196 "No Mapillary Feature in the AoI has an 'organization_id' value."
194197 )
195198 return None
196199 df = df [df ["organization_id" ] == organization_id ]
197200 if start_time is not None :
198201 if df ["captured_at" ].isna ().all ():
199- logger .exception (
200- "No Mapillary Feature in the AoI has a 'captured_at' value."
201- )
202+ logger .info ("No Mapillary Feature in the AoI has a 'captured_at' value." )
202203 return None
203204 df = filter_by_timerange (df , start_time , end_time )
204205 return df
@@ -225,7 +226,7 @@ def get_image_metadata(
225226 aoi_polygon = geojson_to_polygon (aoi_geojson )
226227 downloaded_metadata = coordinate_download (aoi_polygon , level , kwargs )
227228 if downloaded_metadata .empty or downloaded_metadata .isna ().all ().all ():
228- raise ValueError (
229+ raise CustomError (
229230 "No Mapillary Features in the AoI or no Features match the filter criteria."
230231 )
231232 downloaded_metadata = downloaded_metadata .drop_duplicates (subset = ["geometry" ])
@@ -237,7 +238,7 @@ def get_image_metadata(
237238
238239 total_images = len (downloaded_metadata )
239240 if total_images > 100000 :
240- raise ValueError (
241+ raise CustomError (
241242 f"Too many Images with selected filter options for the AoI: { total_images } "
242243 )
243244
0 commit comments