Imrao commited on
Commit
e6a979b
·
1 Parent(s): 0b03e29
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -279,6 +279,19 @@ async def generate_model(request: GenerateRequest):
279
  @app.post("/generate_i3s")
280
  async def generate_i3s(request: GenerateI3SRequest):
281
  """Generate an I3S Layer (SLPK unpacked) from raw coordinates."""
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  rpk_path = get_rpk_path(request.rpk_name)
283
  if not rpk_path:
284
  raise HTTPException(status_code=404, detail="RPK not found")
@@ -343,7 +356,7 @@ async def generate_i3s(request: GenerateI3SRequest):
343
 
344
  enc_options = {
345
  'sceneType': 'Global', # Can also be 'Local', but 'Global' works with appropriate Wkid
346
- 'sceneWkid': str(utm_epsg), # Output in UTM
347
  'baseName': 'SceneLayer',
348
  'sceneName': 'SceneLayer',
349
  'writePackage': False,
 
279
  @app.post("/generate_i3s")
280
  async def generate_i3s(request: GenerateI3SRequest):
281
  """Generate an I3S Layer (SLPK unpacked) from raw coordinates."""
282
+
283
+ # 0. Cleanup Old Layers (as requested)
284
+ # Remove all subdirectories in LAYERS_DIR to keep server clean
285
+ try:
286
+ if os.path.exists(LAYERS_DIR):
287
+ for item in os.listdir(LAYERS_DIR):
288
+ item_path = os.path.join(LAYERS_DIR, item)
289
+ if os.path.isdir(item_path):
290
+ shutil.rmtree(item_path)
291
+ logger.info(f"Cleaned up old layer: {item}")
292
+ except Exception as e:
293
+ logger.warning(f"Cleanup failed: {e}")
294
+
295
  rpk_path = get_rpk_path(request.rpk_name)
296
  if not rpk_path:
297
  raise HTTPException(status_code=404, detail="RPK not found")
 
356
 
357
  enc_options = {
358
  'sceneType': 'Global', # Can also be 'Local', but 'Global' works with appropriate Wkid
359
+ 'sceneWkid': '4326', # Output in UTM
360
  'baseName': 'SceneLayer',
361
  'sceneName': 'SceneLayer',
362
  'writePackage': False,