Tuesday, 14 July 2015

How can I use relative paths in print composer for images?


I'm sharing an entire map project with a client so they can eventually print off an atlas. I've managed to get all the layers and icons to work correctly with relative paths, but the atlas contains images. These don't appear when the client opens the project. Meanwhile, if I truncate the image path to a relative one, the images won't load in my local project.



This seems to be an updated version of this question, and I would also like to avoid modifying startup.py. I notice that I could create an expression to use for the image path, is there some combination of functions that would work for this?



Answer



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



Folder for current project.



So I constructed a concatenation for the image source like.


@project_folder || '/images/image.png'

This worked locally, haven't tested it on the client's Windows machine yet.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...