@@ -269,33 +269,29 @@ def pdal_info(
269
269
]
270
270
cmd_list .append ("--all" ) if with_all else cmd_list .append ("--metadata" )
271
271
cmd_list .append ("{local_path}" )
272
- try :
273
- return_code , output = pdal .execute (
274
- "pdal" ,
275
- command = " " .join (cmd_list ),
276
- local_path = file_path ,
277
- silent = (not verbose ),
278
- output_logging = "BUFFER" ,
279
- )
280
- except Exception as e :
281
- if "Global encoding WKT flag" in str (e ):
282
- logger .warning (f"Pdal failed for tile { file_path } with error { e } ." )
283
- logger .warning ("Setting --readers.las.nosrs true" )
284
- cmd_list .append ("--readers.las.nosrs true" )
285
- return_code , output = pdal .execute (
286
- "pdal" ,
287
- command = " " .join (cmd_list ),
288
- local_path = file_path ,
289
- silent = (not verbose ),
290
- )
291
- else :
292
- raise
272
+
273
+ return_code , output = pdal .execute (
274
+ "pdal" ,
275
+ command = " " .join (cmd_list ),
276
+ local_path = file_path ,
277
+ silent = (not verbose ),
278
+ output_logging = "BUFFER" ,
279
+ )
280
+
281
+ if "Global encoding WKT flag" in str (output ):
282
+ logger .warning (f"Pdal failed for tile { file_path } with output { output } ." )
283
+ # Remove the first line
284
+ output_lines = output .split ("\n " )
285
+ if len (output_lines ) > 1 :
286
+ logger .warning (f"Removing first line from PDAL output : { output_lines [0 ]} " )
287
+ output = "\n " .join (output_lines [1 :])
288
+
293
289
output_processed = output .replace ("\\ u0000" , "" )
294
290
295
291
try :
296
292
json_data = json .loads (output_processed )
297
293
except JSONDecodeError as e :
298
- raise Failure (f"Failed to make JSON from pdal output: { output } . { e } " )
294
+ raise Failure (f"Failed to make JSON from pdal output: { output_processed } . { e } " )
299
295
300
296
return return_code , json_data
301
297
0 commit comments