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

Losing memory layers #15

Open
mikedufty opened this issue Aug 24, 2023 · 3 comments
Open

Losing memory layers #15

mikedufty opened this issue Aug 24, 2023 · 3 comments

Comments

@mikedufty
Copy link

One of my colleagues has had an issue with losing data saved in memory layers.
Unfortunately I can't reproduce it.
I thought it might be the issue I mentioned previously with conflicting plugin versions, but the latest occurrence has happened with a file that has only been edited with the new plugin ie there is no external mldata file, only the one in the .qgz archive.

Thought I'd post here in case others have had similar issues or hints.
Screenshot of the MLS data below, the last 13 entries have 0 features.
Does anyone know what determines the order of the layer listing in the Display memory layer data dialogue?
Are there ways to read or examine the mldata file other than via the plugin?

image

@YoannQDQ
Copy link
Owner

Unfortunately no, there's no way to inspect the binary file, other than recoding the reading function, using QDataStream. You can have a look at the reader.py file, which contains the Reader class, that handles reading the file.

I'd be very interested if you manage to reliably reproduce this issue, as I have no clue what might be causing it at the moment.

Regarding the layer order in the dialog, we use the following function

    def memory_layers(self):
        """Return a list of all memory layers in the project"""
        return [layer for layer in QgsProject.instance().mapLayers().values() if Settings.is_saved_layer(layer)]

This returns the list of the memory layers (whose data provider is memory), in the same order they were added in the project (older first).

@mikedufty
Copy link
Author

Thanks,
I thought the order was oldest to newest too, as when I tested with a new layer it was appended to the end, but when I experimented with a couple more new ones they appeared in the middle of the list.

I'm hoping it doesn't happen again, or if it does that I can pin down the cause. I've come to trust the memory layers very well over the years, so quite a hassle if they are not dependable. Quite a tricky environment with files on a network potentially opened with different versions of qgis. I should make more effort to get everyone up to date. Could very well be an issue that has nothing to do with the plugin.

@romanadew
Copy link

I work with Mike and our team are still having sporadic issues with memory layers, where frequently temporary scratch layers are disappearing on reboot even with the same user, computer and QGIS version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants