Commit e7a316b4 authored by Gaetano Raffaele's avatar Gaetano Raffaele

FIX: bug in multi-code classification

parent 79f9a861
......@@ -690,7 +690,7 @@ def main(argv):
for cshp in shp_list:
map_out = final_fld + '/MAPS/VECTOR_' + cfield + '/' + os.path.basename(cshp).replace('.shp','_' + cfield + '.shp')
map_out_tmp = final_fld + '/MAPS/VECTOR_' + cfield + '/' + os.path.basename(cshp).replace('.shp','_' + cfield + '_tmp.shp')
classify([cshp],cfield,stat_file,model_file,map_out_tmp,var_list)
classify([cshp],'p'+cfield,stat_file,model_file,map_out_tmp,var_list)
keepFields(map_out_tmp,map_out,['Segment_ID','p'+cfield])
shpd.DeleteDataSource(map_out_tmp)
map_list.append(map_out)
......@@ -701,11 +701,11 @@ def main(argv):
os.mkdir(final_fld + '/MAPS/RASTER_' + cfield)
ras_list = []
for map,ref in zip(map_list,ref_list):
ras_list.append(final_fld + '/MAPS/RASTER_' + cfield + '/' + os.path.basename(map).replace('.shp', '_' + cfield + '.tif'))
ras_list.append(final_fld + '/MAPS/RASTER_' + cfield + '/' + os.path.basename(map).replace('.shp', '.tif'))
cmd = ['otbcli_Rasterization', '-in', map, '-im', ref, '-mode', 'attribute', '-mode.attribute.field', 'p'+cfield, '-out', ras_list[-1]]
subprocess.call(cmd,shell=sh)
cmd = ['gdalbuildvrt', '-srcnodata', '0', '-vrtnodata', '0', final_fld + '/Classif_' + cfield + '.vrt'] + ras_list
cmd = ['gdalbuildvrt', '-srcnodata', '0', '-vrtnodata', '0', final_fld + 'MAPS/RASTER_' + cfield + '/Classif_' + cfield + '.vrt'] + ras_list
subprocess.call(cmd, shell=sh)
if single_step:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment