cleaning terminal log
This commit is contained in:
parent
d1f3450c2a
commit
5a4f430599
|
|
@ -100,8 +100,6 @@ async def process_data(df: pd.DataFrame, ext: str, filename: str, fileDesc: str)
|
||||||
geom_type = geom_types[0] if len(geom_types) > 0 else "None"
|
geom_type = geom_types[0] if len(geom_types) > 0 else "None"
|
||||||
null_geom = result.geometry.isna().sum()
|
null_geom = result.geometry.isna().sum()
|
||||||
|
|
||||||
print(f"[INFO] Tipe Geometry: {geom_type}")
|
|
||||||
print(f"[INFO] Jumlah geometry kosong: {null_geom}")
|
|
||||||
else:
|
else:
|
||||||
res = {
|
res = {
|
||||||
"message": "Tidak menemukan tabel yang relevan.",
|
"message": "Tidak menemukan tabel yang relevan.",
|
||||||
|
|
@ -206,7 +204,6 @@ async def handle_upload_file(file: UploadFile = File(...), page: Optional[str] =
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
try:
|
try:
|
||||||
df = None
|
df = None
|
||||||
print('ext', ext)
|
|
||||||
|
|
||||||
if ext == ".csv":
|
if ext == ".csv":
|
||||||
df = read_csv(str(tmp_path))
|
df = read_csv(str(tmp_path))
|
||||||
|
|
@ -236,11 +233,9 @@ async def handle_upload_file(file: UploadFile = File(...), page: Optional[str] =
|
||||||
zip_type = detect_zip_type(str(tmp_path))
|
zip_type = detect_zip_type(str(tmp_path))
|
||||||
|
|
||||||
if zip_type == "shp":
|
if zip_type == "shp":
|
||||||
print("[INFO] ZIP terdeteksi sebagai Shapefile.")
|
|
||||||
df = read_shp(str(tmp_path))
|
df = read_shp(str(tmp_path))
|
||||||
|
|
||||||
elif zip_type == "gdb":
|
elif zip_type == "gdb":
|
||||||
print("[INFO] ZIP terdeteksi sebagai Geodatabase (GDB).")
|
|
||||||
df = read_gdb(str(tmp_path))
|
df = read_gdb(str(tmp_path))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
@ -374,7 +369,6 @@ async def process_parquet_upload(filename: str, table_name: str):
|
||||||
file_path = os.path.join("tmp", filename)
|
file_path = os.path.join("tmp", filename)
|
||||||
|
|
||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
print(f"File {file_path} tidak ditemukan")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -492,7 +486,6 @@ async def process_parquet_upload(filename: str, table_name: str):
|
||||||
"""
|
"""
|
||||||
await conn.execute(alter_sql)
|
await conn.execute(alter_sql)
|
||||||
|
|
||||||
print(f"Sukses upload {len(clean_rows)} baris ke {table_name}.")
|
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -554,7 +547,6 @@ async def handle_to_postgis(payload: UploadRequest, user_id: int = 2):
|
||||||
detected_crs = payload.author.get("crs")
|
detected_crs = payload.author.get("crs")
|
||||||
|
|
||||||
detected = payload.author.get("crs")
|
detected = payload.author.get("crs")
|
||||||
print('crs', detected)
|
|
||||||
|
|
||||||
if not detected_crs:
|
if not detected_crs:
|
||||||
detected_crs = "EPSG:4326"
|
detected_crs = "EPSG:4326"
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ def process_dataframe_synchronous(df_input, tmp_file):
|
||||||
# =========================================================================
|
# =========================================================================
|
||||||
# Hapus baris di mana konversi WKT gagal (None)
|
# Hapus baris di mana konversi WKT gagal (None)
|
||||||
export_df = export_df[export_df["geom"].notnull()]
|
export_df = export_df[export_df["geom"].notnull()]
|
||||||
print("df", export_df)
|
|
||||||
if export_df.empty:
|
if export_df.empty:
|
||||||
raise ValueError("Tidak ada data spasial valid yang ditemukan.")
|
raise ValueError("Tidak ada data spasial valid yang ditemukan.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user