1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | % Shp Path shppath='NFDB_poly_20210707.shp'; S = readgeotable(shppath); [~, prjname, ~]=fileparts(shppath); prjpath=[prjname, '.prj']; % Example: Select polygons where 'LandType' is 'Forest' and 'Area' > 1000 selected_rows = S(S.SRC_AGENCY == "MB" & S.YEAR ==2017, :); % Loop for ii=5:10 rows=selected_rows(selected_rows.MONTH==ii, :); otpath=2017*100+ii; copyfile(prjpath, [num2str(otpath), '.prj']); otpath=[num2str(otpath), '.shp']; shapewrite(rows, otpath); end |
Monday, March 3, 2025
Matlab: Export the selected polygons from the Shapefile
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment