Skip to content

preprocess.orthorectification

vhrharmonize.preprocess.orthorectification

resolve_output_resolution_for_crs(output_epsg, product_resolution)

Return a safe output resolution for the target CRS. Args: output_epsg: Target output EPSG code. product_resolution: Source product resolution. Returns: Safe output resolution or None.

gcp_refined_rpc_orthorectification(input_image_path, output_image_path, dem_image_path, output_epsg, gcp_geojson_file_path=None, output_nodata_value=None, dtype=None, output_resolution=None, log_to_console=False, scene_basename=None)

Orthorectify an image using RPC metadata. Args: input_image_path: Input raster path. output_image_path: Output orthorectified raster path. dem_image_path: DEM raster path. output_epsg: Target output EPSG code. gcp_geojson_file_path: Optional RPC refinement GeoJSON path. output_nodata_value: Optional output nodata value. dtype: Optional GDAL output dtype name. output_resolution: Optional output resolution scalar or x/y tuple. log_to_console: Whether to emit console logs. scene_basename: Optional scene basename for log prefixes. Returns: None.

qgis_gcps_to_csv(input_gcp_path, output_epsg=None, log_to_console=False, scene_basename=None)

Convert QGIS GCP text to GDAL CSV text. Args: input_gcp_path: QGIS GCP text file path. output_epsg: Optional EPSG code used to transform map coordinates. log_to_console: Whether to emit console logs. scene_basename: Optional scene basename for log prefixes. Returns: GDAL-compatible CSV text.

geo_to_image_coords(dataset, x, y)

Transform map coordinates into image coordinates. Args: dataset: GDAL dataset with GCPs. x: Input x coordinate. y: Input y coordinate. Returns: Success flag and transformed pixel coordinates.

qgis_gcps_to_geojson(input_image_path, qgis_gcp_file_path, file_name, dem_file_path, output_geojson_path, force_positive_pixel_values=False, log_to_console=False, scene_basename=None)

Convert QGIS GCP text into Orthority GeoJSON control points. Args: input_image_path: Input raster path. qgis_gcp_file_path: QGIS GCP text file path. file_name: File name stored in control point properties. dem_file_path: DEM raster path used to sample elevations. output_geojson_path: Output GeoJSON path. force_positive_pixel_values: Whether to force positive pixel coordinates. log_to_console: Whether to emit console logs. scene_basename: Optional scene basename for log prefixes. Returns: None.