Skip to content

Commit

Permalink
Merge branch 'devel' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cdbethune committed Sep 26, 2024
2 parents 63071e9 + 0a5cc55 commit a52633c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 8 additions & 4 deletions cdr/result_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ def _push_georeferencing(self, result: RequestResult):
]

logger.info(
f"projecting image {result.image_path} to {output_file_name_full} using crs {GeoreferenceMapper.DEFAULT_OUTPUT_CRS}"
f"projecting image {result.image_path} to {output_file_name_full}. CRS: {lara_result.crs} -> {GeoreferenceMapper.DEFAULT_OUTPUT_CRS}"
)
self._project_georeference(
result.image_path,
output_file_name_full,
projection.crs,
lara_result.crs,
GeoreferenceMapper.DEFAULT_OUTPUT_CRS,
lara_gcps,
)
Expand Down Expand Up @@ -421,8 +421,12 @@ def _push_georeferencing(self, result: RequestResult):
logger.info(
f"result for request {result.request.id} sent to CDR with response {resp.status_code}: {resp.content}"
)
except:
logger.info("error when attempting to submit georeferencing results")
except Exception as e:
logger.exception(
"error when attempting to submit georeferencing results",
e,
exc_info=True,
)

def _project_georeference(
self,
Expand Down
2 changes: 1 addition & 1 deletion deploy/run_cdr.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ docker run \
-v {{ image_dir}}:/imagedir \
-v $1:/input \
--net lara \
uncharted/lara-cdr:test \
uncharted/lara-cdr:{{ tag }} \
--host rabbitmq \
--workdir workdir \
--imagedir imagedir \
Expand Down
10 changes: 8 additions & 2 deletions pipelines/geo_referencing/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ def create_output(self, pipeline_result: PipelineResult) -> Output:


class ProjectedMapOutput(OutputCreator):

DEFAULT_OUTPUT_CRS = "EPSG:3857"

def __init__(self, id: str):
super().__init__(id)

Expand Down Expand Up @@ -372,14 +375,17 @@ def create_output(self, pipeline_result: PipelineResult) -> Output:
]

# create the affine transformation matrix from the gcps
transform = cps_to_transform(gcps, crs, "EPSG:4326")
transform = cps_to_transform(gcps, crs, ProjectedMapOutput.DEFAULT_OUTPUT_CRS)


if pipeline_result.image is None:
raise ValueError("No image found in pipeline result - cannot project")

# project the image using the tansformation matrix - results are returned
# as a geotiff in memory (pillow doesn't support geotiffs)
projected_map = project_image(pipeline_result.image, transform, "EPSG:4326")
projected_map = project_image(
pipeline_result.image, transform, ProjectedMapOutput.DEFAULT_OUTPUT_CRS
)

return BytesOutput(
pipeline_result.pipeline_id, pipeline_result.pipeline_name, projected_map
Expand Down

0 comments on commit a52633c

Please sign in to comment.