Skip to content

Commit fc377f1

Browse files
committed
improve logging and method of replacing vector extension
1 parent e82a935 commit fc377f1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clipping-service/app/app.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _clip_vector_to_bounding_box(
173173

174174
@functools.lru_cache
175175
def cached_file_info(vsi_file_path, file_type):
176-
app.logger.info("Getting file info...")
176+
app.logger.info(f"Getting file info for {file_type} at {vsi_file_path}")
177177
if file_type == RASTER:
178178
try:
179179
return pygeoprocessing.get_raster_info(vsi_file_path)
@@ -286,7 +286,10 @@ def clip():
286286
# align the bounding box
287287
source_file_path = f'/vsicurl/{parameters["file_url"]}'
288288
if source_file_type == VECTOR:
289-
source_file_path = source_file_path.replace('.mvt', '.fgb')
289+
# source_file_path originates in `mappreview` extra; currently always .mvt,
290+
# but leaving this flexible in case we support .geojson again in the future
291+
filename, _ = os.path.splitext(source_file_path)
292+
source_file_path = filename + '.fgb'
290293

291294
source_file_info = cached_file_info(source_file_path, source_file_type)
292295

@@ -300,7 +303,7 @@ def clip():
300303
target_bbox, source_file_info['projection_wkt'],
301304
warping_kwargs['target_projection_wkt'])
302305
except KeyError:
303-
# If we're keeping the same project, just align the requested bounding
306+
# If we're keeping the same projection, just align the requested bounding
304307
# box to the raster's grid.
305308
aligned_target_bbox = _align_bbox(target_bbox, source_file_info)
306309

0 commit comments

Comments
 (0)