1

I switched platforms that I was running QGIS on, and as a result, the path to the source file for a couple layers in my project changed. However, I do not seem to be able to repair the data source. When the repair data source dialog comes up, it lets me navigate to the directory that the source file is in, but it does not show the source file itself. It shows several PDF and JSON files which are in the directory, but my source file is a TXT file.

At the bottom of the dialog it shows:

Original source URI: file:///dev/shm/pts.txt?type=csv&maxFields=10000&detectTypes=yes&xField=longitude&yField=latitude&crs=EPSG:4326&spatialIndex=no&subsetIndex=no&watchFile=no

The part of the URI before the query string is clickable, but doing so only bring up the file explorer. I don't seem to be able to actually edit the original source URI.

I tried renaming my save file from qgz to gz, then gunzipping it, and editing it in a text editor, and replacing all occurrences of dev/shm with the new correct path (so the URL now reads something along the lines of file:///B:/path/to/pts.txt?...), then gzipping it back up and renaming it back to qgz, but when I open this file I get a completely blank project.

I also tried auto-finding when the project first loads, but it stops responding for a few seconds and then the QGIS app spontaneously disappears (e.g. exits).

What is the correct way to get QGIS to recognize my data sources?

1
  • In my case the data source path and file name is shown correctly but it refuses to load the file. The layer is there but it is empty. It is a vector layer with points geometry and the data source is a simple .csv file. This whole thing happened when I moved several .csv files to a new directory on my disk. The funny thing is that I was able to "repair" (i.e. repoint to the new location) all other similar point layers, but this one layer with the correct (new path) file shown as its data source in the layer properties refuses to load the points. I checked file contents, file names and paths sev
    – Vasilios
    Jan 6, 2023 at 16:57

1 Answer 1

2

It isn't immediately obvious, at least to me, but when the dialog first opens showing the missing sources, it is possible to click into the URI and edit it directly from there. Then apply the changes and you should be good to go. This is what worked for me.

2
  • You answered yourself!?! I don't understand
    – katagena
    Sep 2, 2022 at 13:30
  • @katagena I asked the question, kept fiddling with it, and figured out the answer. Posted in case it might help someone else in the future.
    – Michael
    Sep 2, 2022 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.