Shape Write Error when attempting to write to .shp
6 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!