|
|
|
@ -76,7 +76,7 @@ def raster2vector(srcimg_path, mask_path, save_path, ignore_index=255): |
|
|
|
|
vec_ext = save_path.split(".")[-1].lower() |
|
|
|
|
if vec_ext not in ["json", "geojson", "shp"]: |
|
|
|
|
raise ValueError( |
|
|
|
|
"The ext of `save_path` must be `json/geojson` or `shp`, not {}.". |
|
|
|
|
"The extension of `save_path` must be 'json/geojson' or 'shp', not {}.". |
|
|
|
|
format(vec_ext)) |
|
|
|
|
ras_ext = srcimg_path.split(".")[-1].lower() |
|
|
|
|
if osp.exists(srcimg_path) and ras_ext in ["tif", "tiff", "geotiff", "img"]: |
|
|
|
@ -93,7 +93,7 @@ parser = argparse.ArgumentParser() |
|
|
|
|
parser.add_argument("--mask_path", type=str, required=True, \ |
|
|
|
|
help="Path of mask data.") |
|
|
|
|
parser.add_argument("--save_path", type=str, required=True, \ |
|
|
|
|
help="Path to save the shape file (the file suffix is `.json/geojson` or `.shp`).") |
|
|
|
|
help="Path to save the shape file (the extension is .json/geojson or .shp).") |
|
|
|
|
parser.add_argument("--srcimg_path", type=str, default="", \ |
|
|
|
|
help="Path of original data with geoinfo. Default to empty.") |
|
|
|
|
parser.add_argument("--ignore_index", type=int, default=255, \ |
|
|
|
|