Shapefile read errors please help!

All:
I am a very beginner programer and I am running into some problems attempting to use the shaperead function. Every time I try and read a shapefile I get this error:
Error using openShapeFiles>checkSHP (line 67)
Unable to open both al092911_lin.shp and al092911_lin.SHP.
Error in openShapeFiles (line 18)
[basename, ext] = checkSHP(basename,shapeExtensionProvided);
Error in shaperead (line 206)
[shpFileId, shxFileId, dbfFileId, headerTypeCode] ...
Error in shape (line 1)
shaperead('al092911_lin.shp')
I have tried multiple shape files and still get the same thing. Any advice?

8 comentarios

If you give the MATLAB command
ls al092911*
what shows up ?
dpb
dpb el 14 de Dic. de 2013
Editada: dpb el 14 de Dic. de 2013
I'm guessing (and presume from his comment Walter is too) that the file doesn't have an extension and the internal routine checkSHP has tried to find one with the two choices of capitalization for the extension shp and failed to find either of those two choics...it's also possible there is an extension but it has a different capitalization pattern.
Walter Roberson
Walter Roberson el 15 de Dic. de 2013
Or the file does not exist at all, or is in a different directory.
dpb
dpb el 15 de Dic. de 2013
Editada: dpb el 15 de Dic. de 2013
I'd have thought that would be a different message...but it's certainly possible the routine might not have the "doesn't exist" message in its vocabulary.
If still searching for the answer OP could try
[~,msg]=fopen('al092911_lin.shp')
at the command line and observe the message. It may be more informative of the actual problem. And, of course, follow up w/ determining the actual location of the file if not in current working directory. Also OP should be aware of matlabpath as the search path that Matlab uses to find files...
Ikmal Rosli
Ikmal Rosli el 24 de Nov. de 2021
Hi Kenneth, have you found the solution to the problem? I am encountering the same problem too.
KSSV
KSSV el 24 de Nov. de 2021
@Ikmal Rosli what version you are using?
Ikmal Rosli
Ikmal Rosli el 24 de Nov. de 2021
@KSSV MATLAB 2021a, I am not sure if the problem arose from the file itself, or the machine I am using. I have tried using shapeinfo and shaperead on multiple .shp files and gotten the same results as the OP.
Ikmal Rosli
Ikmal Rosli el 24 de Nov. de 2021
@KSSV never mind got it. I just had to add the files into the MATLAB path.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Preguntada:

el 12 de Dic. de 2013

Comentada:

el 24 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by