Compare commits

...

No commits in common. "731eb5787868e62956292c37970abc71fa644d67" and "f3450d2822fafaeda52b991af812abd08e8a103c" have entirely different histories.

2 changed files with 6 additions and 9 deletions

View File

@ -24,14 +24,7 @@ def reproject_raster(input_path, output_path, target_srs='EPSG:3003'):
# Get the target spatial reference system
srs_target = osr.SpatialReference()
# se target_srs è un int, lo considero come EPSG
if target_srs.isdigit():
srs_target.ImportFromEPSG(int(target_srs))
else:
# se target_srs è una stringa, la considero come formato 'EPSG:xxxx'
srs_val = int(target_srs.split(':')[1])
srs_target.ImportFromEPSG(srs_val)
srs_target.ImportFromEPSG(int(target_srs.split(':')[1]))
# Get the source spatial reference system
srs_source = dataset.GetProjection()
@ -151,7 +144,7 @@ if __name__ == "__main__":
# Subparser for the reproject_raster function
parser_reproject = subparsers.add_parser("reproject", help="Reproject a raster file to a new spatial reference system. Syntax: reproject -i <input_path> -o <output_path> -t <target_srs>")
parser_reproject = subparsers.add_parser("reproject", help="Reproject a raster file to a new spatial reference system.")
parser_reproject.add_argument("-i", "--input_path", required=True, help="Path to the input raster file.")
parser_reproject.add_argument("-o", "--output_path", required=True, help="Path to the output raster file.")
parser_reproject.add_argument("-t", "--target_srs", default="EPSG:3003", help="Target spatial reference system in EPSG format (default: 'EPSG:3003').")
@ -169,6 +162,7 @@ if __name__ == "__main__":
parser_details.add_argument("-i", "--input_path", required=True, help="Path to the input raster file.")
parser_details.add_argument("-o", "--output_path", required=False, help="Path to the output details file.")
# Subparser for the clip_raster function
parser_clip = subparsers.add_parser("clip", help="Clip a raster file to a specified extent.")
parser_clip.add_argument("-i", "--input_path", required=True, help="Path to the input raster file.")
@ -176,6 +170,9 @@ if __name__ == "__main__":
parser_clip.add_argument("-x", "--min_x", type=float, required=True, help="Minimum x coordinate for the clipping extent.")
parser_clip.add_argument("-y", "--min_y", type=float, required=True, help="Minimum y coordinate for the clipping extent.")
parser_clip.add_argument("-X", "--max_x", type=float, required=True, help="Maximum x coordinate for the clipping extent.")
parser_clip.add_argument("-Y", "--max_y", type=float, required=True, help="Maximum y coordinate for the clipping extent.")
args = parser.parse_args()

View File