Loop3D / map2loop

MIT License
9 stars 9 forks source link

StupidGDALLocalFile #12

Open markjessell opened 8 months ago

markjessell commented 8 months ago

Did you try https://gdal.org/user/virtual_file_systems.html#vsimem-in-memory-files

GDAL writing to and reading from virtual memory?

RoyThomsonMonash commented 8 months ago

I did use in memory files for netCDF based and http based heightmaps but for some reason I couldn't get WebCoverageService based heightmaps to load into memory. This is the only case it is necessary.

lachlangrose commented 3 months ago

I'm reoppening this issue because if the user doesn't have permission to write to the m2l_data_tmp/StupidGDALLocalFile.tif file then it will crash map2loop.

For me I get an error if I run the plot_hamersley example from a root directory. E.g. from the map2loop repo run python docs/examples/plot_hamersley.py' will returnPermissionError: [Errno 13] Permission denied: 'm2l_data_tmp/StupidGDALLocalFile.tif'` but if I run from the docs/examples directory it will work.

Why not use the system tmp directory? https://docs.python.org/3/library/tempfile.html

AngRodrigues commented 3 months ago

Good idea, we're already using tempfile in some of the tests, e.g., https://github.com/Loop3D/map2loop/blob/master/tests/thickness/StructurePoint/test_thickness_StructuralPoint_local_source.py, and seems to be working well.