Borrar filtros
Borrar filtros

Shape Write Error when attempting to write to .shp

3 visualizaciones (últimos 30 días)
Elliot Stevens
Elliot Stevens el 14 de Oct. de 2021
Respondida: arushi el 21 de Ag. de 2024
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

Respuestas (1)

arushi
arushi el 21 de Ag. de 2024
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.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by