Skip to content

Commit

Permalink
if no sidewalks or crosswalks, return empty geodataframes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhodcz2 committed Sep 8, 2024
1 parent 98c677a commit 111bb3d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tile2net/raster/pednet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import datetime
import shutil
import warnings

import pandas as pd
import os
Expand Down Expand Up @@ -217,6 +218,11 @@ def create_crosswalk(self):
cw_ntw.geometry = cw_ntw.geometry.set_crs(3857)
smoothed = wrinkle_remover(cw_ntw, 1.3)
self.crosswalk = smoothed
else:
warnings.warn('No crosswalks found')
self.crosswalk = gpd.GeoDataFrame({
'geometry': [],
},crs=3857)

def create_lines(self, gdf: gpd.GeoDataFrame) -> gpd.GeoDataFrame:
"""
Expand Down Expand Up @@ -322,6 +328,11 @@ def create_sidewalks(self):
except:
# logging.info('cannot save modified')
self.sidewalk = sw_uni_lines
else:
warnings.warn('No sidewalk polygons found')
self.sidewalk = gpd.GeoDataFrame({
'geometry': [],
}, crs=3857)

self.sidewalk['f_type'] = 'sidewalk'

Expand Down

0 comments on commit 111bb3d

Please sign in to comment.