Azzera filtri
Azzera filtri

Shape Write Error when attempting to write to .shp

6 visualizzazioni (ultimi 30 giorni)
Elliot Stevens
Elliot Stevens il 14 Ott 2021
Risposto: arushi il 21 Ago 2024 alle 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

Risposte (1)

arushi
arushi il 21 Ago 2024 alle 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.

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by