Shapewrite Error: Unknown Shape Identification
显示 更早的评论
Hello All,
I am attempting to export a shapefile from my matlab code that will include 4 field
Shapefile = [X,Y,ID,Magnitude].
I have tried using both the mappoints and geopoints methods in order to create a strucutred array, and then using the shapewrite function to output the shapefile, however, every time I attempt to run the shapewrite function I get a "Unknown shape identification: shapefile_name.shp'
In addition, I have tried using the examples on the shapewrite documentation and get the same error using those examples. Googling has not yielded any results as to what the error could indicate either.
I've attached a text file with the ID, Coordinates X, Coordinate Y, and Magnitude below if anyone else wants to attempt converting this to a point shapefile with ID and Magnitude attributes.
1 个评论
Guillaume
2020-1-23
Please give the full text of the error message. Everything in red.
回答(1 个)
Shubh Sahu
2020-1-28
Hey!
Please try reading your data in this way and then use Shapewrite.
clear all; clc;
s = tdfread('New Text Document.txt', '\t');
tableData = s.x_10x2E7100000e0x2B02_90x2E2359296e0x2B05_20x2E2919476e0x2B05_0;
ShapeFile.X = tableData(:, 1);
ShapeFile.Y = tableData(:, 2);
ShapeFile.ID = tableData(:, 3);
ShapeFile.Mag = tableData(:, 4);
shapewrite(mappoint(ShapeFile), 'shapefile_name.shp');
shaperead('shapefile_name.shp')
Hope this will help you.
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!