Skip to main content
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 ...
user2856's user avatar
  • 67.9k
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 ...
Jay Cummins's user avatar
  • 14.7k
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 ...
YoLecomte's user avatar
  • 3,340
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 ...
Kazuhito's user avatar
  • 31.1k
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 ...
Mads's user avatar
  • 129
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, ...
gisnside's user avatar
  • 7,868
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", ...
Kadir Şahbaz's user avatar
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 ...
Tyler Erickson's user avatar
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 "...
oat's user avatar
  • 407
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 ...
nielsgerrits's user avatar
  • 3,946
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:
nielsgerrits's user avatar
  • 3,946
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 ...
J. Monticolo's user avatar
  • 15.9k
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 ...
Sanch's user avatar
  • 215
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(...
user2856's user avatar
  • 67.9k
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, ...
Babel's user avatar
  • 73.8k
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 ...
Kadir Şahbaz's user avatar
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 ...
Taras's user avatar
  • 33.7k
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 ...
atxgis's user avatar
  • 1,239
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/...
Spacedman's user avatar
  • 65.6k
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 ...
JonasV's user avatar
  • 3,794
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 ...
Houska's user avatar
  • 8,316
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"
Kadir Şahbaz's user avatar
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 - ...
volda's user avatar
  • 393
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 ...
Tim's user avatar
  • 390
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 ...
til_b's user avatar
  • 5,197
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 ...
Babel's user avatar
  • 73.8k
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 ...
raphael's user avatar
  • 3,407
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 ...
fatih_dur's user avatar
  • 5,003
3 votes

Full Network Paths In QGIS

You can set the project to use absolute paths under the General tab of the Project options.
giohappy's user avatar
  • 1,262
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 ...
IvanSanchez's user avatar
  • 10.3k

Only top scored, non community-wiki answers of a minimum length are eligible