Skip to content

Commit

Permalink
refactor: pass args.data_extract and have parsing function handle it
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Aug 9, 2024
1 parent 272cf90 commit 8cc7663
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions fmtm_splitter/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import geojson
import numpy as np
from geojson import Feature, FeatureCollection, GeoJSON
from osm_rawdata.postgres import PostgresClient
from psycopg2.extensions import connection
from shapely.geometry import Polygon, shape
from shapely.geometry.geo import mapping
Expand All @@ -43,6 +42,7 @@
drop_tables,
insert_geom,
)
from osm_rawdata.postgres import PostgresClient

# Instantiate logger
log = logging.getLogger(__name__)
Expand Down Expand Up @@ -778,22 +778,12 @@ def main(args_list: list[str] | None = None):
raise ValueError(err)

if args.meters:
if args.extract:
file = open(args.extract, "r")
data = geojson.load(file)
file.close()
split_by_square(
args.boundary,
meters=args.meters,
osm_extract=data,
outfile=args.outfile,
)
else:
split_by_square(
args.boundary,
meters=args.meters,
outfile=args.outfile,
)
split_by_square(
args.boundary,
meters=args.meters,
outfile=args.outfile,
osm_extract=args.extract,
)
elif args.number:
split_by_sql(
args.boundary,
Expand Down

0 comments on commit 8cc7663

Please sign in to comment.