필터 지우기
필터 지우기

Shape Write Error when attempting to write to .shp

조회 수: 6 (최근 30일)
Elliot Stevens
Elliot Stevens 2021년 10월 14일
답변: arushi 2024년 8월 21일 5:40
Hi,
working my way through the topotoolbox functions and trying to write a STRUCT to a .shp and it is coming up with the following errors:
>> MS = STREAMobj2mapstruct(S);
shapewrite(MS,'testshape.shp')
Error using shapewrite>writeSHP (line 95)
Unable to open testshape.shp for writing.
Error in shapewrite (line 81)
[shapeType, boundingBox, index] = writeSHP(S,basename);
I have mapping toolbox installed and all other fuctions worked up to thsi point so just abit lost
Thanks

답변 (1개)

arushi
arushi 2024년 8월 21일 5:40
Hi Elliot,
The error you are encountering suggests that there might be an issue with file permissions, the path where you are trying to save the file, or possibly the structure of the data you are trying to write. Here are some steps to troubleshoot and resolve the issue:
1. Check File Path and Permissions:
- Ensure that you have write permissions to the directory where you are trying to save the `testshape.shp` file.
2. Verify Structure of `MS`:
- Make sure that `MS` is a valid map structure that `shapewrite` can process. The structure should contain fields like `Geometry`, `X`, `Y`, and any other necessary attributes.
- You can inspect the structure by using the `disp` or `struct` commands to ensure it matches the expected format.
3. Close Other Applications:
- Ensure that no other applications are using or locking the file `testshape.shp`. Sometimes, files can be locked by other processes, preventing MATLAB from writing to them.
4. Check MATLAB's Current Directory:
- Confirm that MATLAB's current working directory is set correctly. You can check this by using the `pwd` command and change it with `cd` if necessary.
Hope this helps.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by