14
votes
Accepted
Open .qgz files to edit file paths
To fix this manually, rename .qgz to .zip, extract zip, change paths, re-zip, rename .zip to .qgz.
Alternatively, I've hacked together a very basic and very minimally tested python script to do this ...
10
votes
Saving project with data source path as relative in QGIS?
In version 2.18, the relative path was an option but didn't actually work.
Project ➜ Project Properties ➜ General ➜ General settings ➜ Save paths.
However, it does work in 3.2:
Project ➜ Properties ...
10
votes
Accepted
Changing QGIS system SVG path with PyQGIS
Tested in QGIS 3.2 Python Console under Ubuntu 18.04:
To find the settings you need, you can use
settings = QSettings().allKeys()
This will create a list of all available Settings (it can help to ...
9
votes
Accepted
Cannot select input layers for the "Polygonize" tool in QGIS
When you search for Polygonize in the Processing Toolbox, there appear several tools.
1) Polygonize tool converts line layer to polygon layer, turning an area inside three line segments into a ...
8
votes
Saving project with data source path as relative in QGIS?
In QGIS 3.10 you can open the Projects tab and click on Properties, then click on the General tab. A new window will show up as portrayed in the screen capture below. The selection is highlighted in ...
7
votes
Accepted
Remapping layers in QGIS project to other folders?
You have a great plugin named "ChangeDataSource", doing just that very easily. The only downside is that you can only do one layer at a time.
Works on any layer type, including database layers, ...
7
votes
Accepted
Chaging default path for saving output layouts in QGIS
You can use writeEntry method of QgsProject.
QgsProject.instance().writeEntry("Layouts", # scope
"/lastLayoutExportDir", ...
6
votes
Accepted
Earth Engine: Evaluating ee.Number in file path
In the first (working) example, the entire analysis is done client-side.
In the second (non-working) example, you are mixing a client-side Javascript function .concat() with a server-side Earth ...
6
votes
Relative path not working in QGIS with Google Drive?
I looked at the .qgs project file before and after I use the "save as" function.
It seems that the the relative path for a shp file will be changed to an absolute path after the project file is "...
6
votes
Accepted
Map tips and the use of relative paths
In QGIS 2.16.1 you can use the variable @project_folder. This returns the path of the folder the project is saved in. When the data or datafolder is saved in this project folder as well you can ...
6
votes
Accepted
Using timestamp in text format published parameter of FME?
A TimeStamper will create an attribute with yyyymmdd. Next you can fanout on both filename and sheetname:
6
votes
Accepted
Change layer path using PyQGIS
If you look at the PyQGIS documentation, you'll see that the function has not enough arguments, it miss the baseName, provider and data provider options. The code below works for me. I just take all ...
6
votes
Save processing modeler output layers to project folder/relative path?
First, create the entire process within the modeler, and include the input "File/Folder".
Then open it with the inbuilt Python editor in QGIS, then edit any code with the file path to the ...
6
votes
Passing variable to URI filepath
in your uri variable, Path/name is a literal string, not the variables Path and name.
Try:
uri ="file:///{}/{}?delimiter=,&crs=epsg:25831&xField=Easting&yField=Northing".format(...
6
votes
Accepted
Batch replacing of layer file paths in QGIS
Save your project as QGIS files (.qgs), not the default (zipped) .qgz file - or unzip the .qgz project file. Then you're able to open the project in a text editor in a human-readable format. There, ...
6
votes
Getting the file path of layer based on layer name using PyQGIS
You can use this script:
from glob import glob
from datetime import datetime
from os.path import join, basename
folder = r'C:\Users\CMCA\OneDrive - Boskalis\Desktop\Sample Directory'
# extract date ...
6
votes
"Could not load source layer for INPUT" error when reprojecting flt-file with PyQGIS
I would agree with @BenW's comment, that your binary floating-point files can not be found under this path inputfolderpath + '/' + fltfile_name. However, I could also say, that your input does not ...
5
votes
Accepted
Retrieving Full Path to Feature Class in ArcMap
Not sure if this is as easy as you like, but you can use these three lines of code in the python window (drag or write feature class name for fc variable).
fc = (Drag feature class here from Table Of ...
5
votes
How to get raster layer name in GDAL?
GetDescription returns the full path:
>>> import osgeo
>>> from osgeo import gdal
>>> d = gdal.Open("./swb/srtm_38_04.tif")
>>> d.GetDescription()
'./swb/...
5
votes
Concatenating export path in Google Earth Engine
Export to a Drive folder in Earth Engine is really not documented well (at all). Here's how it works:
If there already is a folder with the specified name in Drive, it will export to there. For this ...
5
votes
Accepted
Filling out field with matching between existing field value and file name in QGIS
Here's a description of what I do in what seems to be an analogous situation.
I have a layer, Photos, which has a "SourceFile" field that has the fully qualified filename of jpegs. I ...
5
votes
Passing variable to URI filepath
You can also use this structure:
uri ="file:///" + Path + "/" + name + "?delimiter=,&crs=epsg:25831&xField=Easting&yField=Northing"
4
votes
Linking to external files with relative path in QGIS actions
There is another solution for portable project with relative path for any attachment. With this solution you can open any document using system default browser/viewer.
Create new Action
Select type - ...
4
votes
Accepted
QGIS 3.16.16 and Sharepoint
I'm currently going through similar things at a new job having come from working with normal file servers/network shares.
Firstly, QGIS/Sharepoint doesn't seem to have any trouble with the different ...
4
votes
Getting the file path of layer based on layer name using PyQGIS
When you write
path_file = 'C:\Users\CMCA\OneDrive - Boskalis\Desktop\Sample Directory'
the Python interpreter will treat the backslashes as control characters. It will try to decode a Unicode ...
4
votes
Setting relative path for PDF linking to shapefile in QGIS
Solution
Using QGIS expression with function file_path() and variable @layer, you get the path of the current layer: file_path (@layer). Using this, the file you want to access must be stored in the ...
3
votes
Accepted
How can I use relative paths in print composer for images?
As mentioned in the question, I noticed there's an expression builder option next to the image source. Looking under the variables drop down I noticed an option named @project_folder with description ...
3
votes
Accepted
Parse path for any workspace
After seeing your conservation with @GISGE, though reluctantly, I have decided to put in my two cents. I do not think there is a direct way of getting file path of a layer's data source from given ...
3
votes
Full Network Paths In QGIS
You can set the project to use absolute paths under the General tab of the Project options.
3
votes
absolute paths don't work for my leaflet custom icons
URLs must have a scheme (also called protocol). In most cases, the scheme is http:// or https://. If you do not specify a scheme, a browser will interpret that as a relative path, resolving it with ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
file-path × 146qgis × 54
arcgis-desktop × 19
pyqgis × 18
python × 13
arcpy × 12
qgis-3 × 12
raster × 11
arcgis-pro × 11
arcmap × 10
modelbuilder × 10
shapefile × 6
qgis-plugins × 5
layers × 5
qgis-processing × 5
windows × 5
parameters × 5
gdal × 4
arcgis-10.0 × 4
arcgis-10.1 × 4
export × 4
qgis-2 × 4
pdf × 4
linux × 4
mxd × 4