Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 11, 2024
1 parent b4b8ab5 commit 6331940
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions fmtm_splitter/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def geojson_to_shapely_polygon(
raise ValueError(msg)

return shape(features[0].get("geometry"))

def splitBySquare( # noqa: N802
self,
meters: int,
Expand All @@ -175,10 +175,14 @@ def splitBySquare( # noqa: N802

cols = list(np.arange(xmin, xmax + width, width))
rows = list(np.arange(ymin, ymax + length, length))
polygons=[]
polygons = []
if extract_geojson:
features = extract_geojson.get('features', extract_geojson) if isinstance(extract_geojson, dict) else extract_geojson.features
extract_geoms = [shape(feature['geometry']) for feature in features]
features = (
extract_geojson.get("features", extract_geojson)
if isinstance(extract_geojson, dict)
else extract_geojson.features
)
extract_geoms = [shape(feature["geometry"]) for feature in features]
else:
extract_geoms = []

Expand All @@ -192,7 +196,9 @@ def splitBySquare( # noqa: N802
if any(geom.within(clipped_polygon) for geom in extract_geoms):
polygons.append(clipped_polygon)

self.split_features = FeatureCollection([Feature(geometry=mapping(poly)) for poly in polygons])
self.split_features = FeatureCollection(
[Feature(geometry=mapping(poly)) for poly in polygons]
)
return self.split_features

def splitBySQL( # noqa: N802
Expand Down Expand Up @@ -424,7 +430,7 @@ def split_by_square(
railway: not null
aeroway: not null
"""
)
)
# Must be a BytesIO JSON object
config_bytes = BytesIO(config_data.encode())

Expand Down

0 comments on commit 6331940

Please sign in to comment.