Compare commits

...

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

2 changed files with 9 additions and 6 deletions

View File

@ -24,7 +24,14 @@ def reproject_raster(input_path, output_path, target_srs='EPSG:3003'):
# Get the target spatial reference system
srs_target = osr.SpatialReference()
srs_target.ImportFromEPSG(int(target_srs.split(':')[1]))
# 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)
# Get the source spatial reference system
srs_source = dataset.GetProjection()
@ -144,7 +151,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.")
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.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').")
@ -162,7 +169,6 @@ 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.")
@ -170,9 +176,6 @@ 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()

0
requirements.txt Normal file
View File