MATLAB Answers

Shapewrite Error: Unknown Shape Identification

15 views (last 30 days)
Russell Nasrallah
Russell Nasrallah on 23 Jan 2020
Answered: Shubh Sahu on 28 Jan 2020
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 Comment
Guillaume
Guillaume on 23 Jan 2020
Please give the full text of the error message. Everything in red.

Sign in to comment.

Answers (1)

Shubh Sahu
Shubh Sahu on 28 Jan 2020
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.

Community Treasure Hunt

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

Start Hunting!

Translated by