Commit edf2a94b authored by Nicolas Garcia Ospina's avatar Nicolas Garcia Ospina
Browse files

Removed file creator with geometries and used black

parent c83487d0
Pipeline #24751 passed with stage
in 4 minutes and 57 seconds
......@@ -19,7 +19,6 @@
import os
import logging
import geopandas
import pandas
# Initialize log
......@@ -27,33 +26,6 @@ logger = logging.getLogger(__name__)
class FileProcessor:
@staticmethod
def write_tiles_to_csv(
list_of_dictionaries, output_pathname, column_geometry="built_area", crs="epsg:4326"
):
"""Write a csv file from a list of dictionaries.
Args:
list_of_dictionaries (list): List of dictionaries with built-up areas to
write.
output_pathname (str): Target path name for the csv file.
column_geometry (str): Name of the field that contains geometries.
Default = "built_area"
crs (str): EPSG code of the data projection. Default = "epsg:4326"
"""
tiles_gdf = geopandas.GeoDataFrame(
list_of_dictionaries, geometry=column_geometry, crs=crs
)
filepath_out = os.path.join(
output_pathname, "{}_{}.csv".format(tiles_gdf.quadkey.iloc[0], len(tiles_gdf.index))
)
logger.info("Creating {}".format(filepath_out))
tiles_gdf.to_csv(filepath_out, index=False)
@staticmethod
def write_tiles_to_csv_no_geom(list_of_dictionaries, output_pathname):
"""Write a csv file from a list of dictionaries without geometries.
......@@ -66,10 +38,10 @@ class FileProcessor:
"""
tiles_df = pandas.DataFrame(list_of_dictionaries)
tiles_df = tiles_df.drop_duplicates(keep='first')
tiles_df = tiles_df.drop_duplicates(keep="first")
filepath_out = os.path.join(
output_pathname,
"OBM_{}_{}.csv".format(tiles_df.quadkey.iloc[0], len(tiles_df.index)),
"{}_{}.csv".format(tiles_df.quadkey.iloc[0], len(tiles_df.index)),
)
logger.info("Creating {}".format(filepath_out))
tiles_df.to_csv(filepath_out, index=False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment