Skip to content

Commit

Permalink
fix: make zone lookup more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Jul 10, 2024
1 parent 3f171db commit eef0e8e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions zonalda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ def __getitem__(self, name: str) -> tuple[
zone = zones.iloc[0]
district, collecte = None, None
districts = self.districts.loc[self.districts.contains(zone.geometry)]
if len(districts) == 0:
districts = self.districts.loc[self.districts.intersects(zone.geometry)]
if len(districts) > 1:
LOGGER.warning("Plusieurs districts trouvé pour %s: %s", name, districts)
if len(districts):
district = districts.iloc[0]
collectes = self.collectes.loc[self.collectes.contains(zone.geometry)]
if len(collectes) == 0:
collectes = self.collectes.loc[self.collectes.intersects(zone.geometry)]
if len(collectes) > 1:
LOGGER.warning(
"Plusieurs zones de collectes trouvé pour %s: %s", name, collectes
Expand Down

0 comments on commit eef0e8e

Please sign in to comment.