Creation of projection metadata file (*.prj) for shapefiles

조회 수: 21 (최근 30일)
Melanie VT
Melanie VT 2023년 2월 27일
댓글: Melanie VT 2023년 7월 6일
Dear All,
The in-built shapewrite function creates three output files: [basename '.shp'], [basename '.shx'], and [basename '.dbf']. There is no option to export the projection metadata (.prj) file, whose absence causes a crucial problem while using the shapefile in the GIS software environment. Is there any workaround to create a projection metadata (.prj) file in MATLAB?
Cheers,
Mel
  댓글 수: 2
PADMAKAR
PADMAKAR 2023년 6월 6일
Facing the same issue. I dont seen any workaround..
Melanie VT
Melanie VT 2023년 6월 30일
I could also find nothing in other forums @PADMAKAR. I thought it might be added in the R2023a, but unfortunately, it didn't. Fingers crossed for future versions😊

댓글을 달려면 로그인하십시오.

채택된 답변

Kojiro Saito
Kojiro Saito 2023년 7월 6일
As of R2023a, shapewrite does not create .prj file, so you need to create it with wktstring and writematrix.
Here is a sample.
shp = shaperead('boston_placenames.shp');
shpInf = shapeinfo('boston_placenames.shp');
% Create .shp, .shx and .dbf files
shapewrite(shp, 'out.shp')
% Create Well-known text string
wkt = wktstring(shpInf.CoordinateReferenceSystem);
% Create .prj file
writematrix(wkt,'out.prj','FileType','text', 'QuoteStrings', false)
Now R2023b Prerelease is open and shapewrite will support creating .prj file.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by