3

I'm using QGIS and QField and I have a local directory containing XYZ tiles in the same directory as the project file. If I put the absolute path like that as URL, it works fine:

  • file:///home/me/project/tile/{z}/{x}/{y}.png

But, when I synchronize the tiles to QField on my cell phone, the path of all that changes.

So, I've naively tried those solutions (the project file is in /home/me/project/my.qgz):

  • file://tile/{z}/{x}/{y}.png
  • file://./tile/{z}/{x}/{y}.png
  • file:tile/{z}/{x}/{y}.png
  • file://@project_folder/tile/{z}/{x}/{y}.png
  • file://[% @project_folder %]/tile/{z}/{x}/{y}.png

But none worked.

Any idea how I could have file URLs relative to the project path or if I can use variables, in there?

1
  • try converting it to MBTiles Commented Jul 6, 2023 at 3:06

1 Answer 1

1

I tried exactly the same thing. The only workaround I found this far was using @project_folder to get the path from a mobile device.

I've added a layer with a column that had the default @project_folder. So if an user would add an item the path would be stored in this column

After that, I changed the URL to this path. In QGIS the layer would not appear anymore. But when you upload it to the phone, it wil appear on the phone. The downside of this method is that it is still an absolute path. So if there are multiple users the changes they differ in path are great.

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.