Filter löschen
Filter löschen

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

27 Ansichten (letzte 30 Tage)
Melanie VT
Melanie VT am 27 Feb. 2023
Kommentiert: Melanie VT am 6 Jul. 2023
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 Kommentare
PADMAKAR
PADMAKAR am 6 Jun. 2023
Facing the same issue. I dont seen any workaround..
Melanie VT
Melanie VT am 30 Jun. 2023
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😊

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kojiro Saito
Kojiro Saito am 6 Jul. 2023
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.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by