Creation of projection metadata file (*.prj) for shapefiles
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Melanie VT
el 27 de Feb. de 2023
Comentada: Melanie VT
el 6 de Jul. de 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 comentarios
Respuesta aceptada
Kojiro Saito
el 6 de Jul. de 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.
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!