Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error opening .2dm and .xmdf mesh data #40385

Closed
95camarones opened this issue Dec 1, 2020 · 11 comments
Closed

Error opening .2dm and .xmdf mesh data #40385

95camarones opened this issue Dec 1, 2020 · 11 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! macOS Mesh Related to general mesh layer handling (not specific data formats)

Comments

@95camarones
Copy link

Describe the bug
Having reopened a project containing TUFLOW .2dm mesh data I get the following error:
Screenshot 2020-12-01 at 15 35 45

After that, the map display will not refresh - I can zoom but the extents do not change and turning layers on and off does not make them appear or disappear. I now get this error every time I add a .2dm. Restarting the computer does not help. The only thing that works seems to be to reinstall QGIS.

How to Reproduce
Example TUFLOW .2dm data here.

  1. Add .2dm mesh.
  2. Right-click on .2dm layer in layer panel and choose Properties... -> Source -> Add additional dataset and add .xmdf data.
  3. Turn layer off.
  4. Save project.
  5. Restart QGIS or close and reopen project.
  6. Turn layer back on and get following error:

Tools::TemporaryFile: Cannot create temporary file name.: unspecified iostream_category error

QGIS and OS versions

QGIS version 3.16.1-Hannover QGIS code revision 3ecbe06
Compiled against Qt 5.14.2 Running against Qt 5.14.2
Compiled against GDAL/OGR 3.1.2 Running against GDAL/OGR 3.1.2
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version macOS Mojave (10.14.6)
Active python plugins quick_map_services

Also tried on 3.10 A Coruña with same result.

@95camarones 95camarones added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Dec 1, 2020
@gioman
Copy link
Contributor

gioman commented Dec 1, 2020

No error on Linux and Windows, so seems a macOS only issue.

@gioman gioman added Mesh Related to general mesh layer handling (not specific data formats) macOS labels Dec 1, 2020
@saberraz
Copy link
Contributor

saberraz commented Dec 1, 2020

Indeed...it works fine with QGIS master on Linux. CC @PeterPetrik

@PeterPetrik
Copy link
Contributor

i have seen this few times, but never able to replicate it consistently. If I remember correctly, it comes from spatialindex when it tries to save temporary files when creating index.

@drf5n
Copy link

drf5n commented Dec 10, 2020

i have seen this few times, but never able to replicate it consistently. If I remember correctly, it comes from spatialindex when it tries to save temporary files when creating index.

Temporary files might be in a non-writable location #35651 (comment)

Try this in the Python console to determine the current working directory, and see if it is a good place to write files.

import os
os.getcwd()

@PeterPetrik PeterPetrik self-assigned this Feb 2, 2021
@PeterPetrik
Copy link
Contributor

PeterPetrik commented Feb 2, 2021

https://github.com/libspatialindex/libspatialindex/blob/32ec7f99f960369b55d1eb333f2b02aab059330b/src/tools/Tools.cc#L1055

^^ this code creates a tmp file relative to current working directory on MacOS, which is on /Applications/QGIS.app/... where user cannot write

@PeterPetrik
Copy link
Contributor

@drf5n
Copy link

drf5n commented Feb 5, 2021

Did commit 590b7f4 fix this?

@PeterPetrik
Copy link
Contributor

nope, fixed spatialite to correctly use TMPDIR to store temporary files (https://github.com/qgis/QGIS-Mac-Packager/blob/master/qgis_deps/recipes/spatialindex/patches/temporaryfile.patch)

@drf5n
Copy link

drf5n commented Feb 5, 2021

Thanks. I thought mkstmp would use the spatialindex-XXXXXX template to create and open files like spatialindex-4dfg32, but the https://github.com/qgis/QGIS-Mac-Packager/blob/master/qgis_deps/recipes/spatialindex/patches/temporaryfile.patch code looks like it would ignore the mkstmp-opened file and open a separate file named something like $TMPDIR/spatialindex-XXXXXX

@PeterPetrik
Copy link
Contributor

sorry, wrong commit :) qgis/QGIS-Mac-Packager@40ca7e8

@drf5n
Copy link

drf5n commented Feb 5, 2021

That's better with the path in the template for the call to mkstmp, so it tries to make a temp file in the given path rather than working dir.

And I was wrong about my other concern--mkstmp modifies the template string to the successful random filename, so the later call to m_pFile = new Tools::BufferedFileWriter(m_sFile, Tools::CREATE); reopens the new filename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! macOS Mesh Related to general mesh layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

5 participants