Thursday 15 June 2017

qgis - Data Defined Override XY offset input


I have several rectangular polygons that overlap each other and I'd like to label them with the ID's (for atlas page numbers). The image below shows my initial setup. I've offset each label from the centroid using the data defined override which I can easily understand how this one works. But I would like to add more offset to each individual label using a CASE WHEN expression, so here's the issue.


At the bottom of the image are two inputs for "Offset X,Y". The data defined override for this option says:


Data defined override
Active: yes (ctrl/right-click toggles)
Expected input:
double coord [X,Y] as <= 0.0 =>
Valid input types:

string, int, double
Current definition (expression):

I've used the overide for other individual coordinate values (just X or just Y) and they work fine because they expect just a single number.


But what is the format for the expression to use BOTH X and Y values?


I've tried two comma sperated numbers in square and curly brackets, as well as just numbers and also without the comma separation but I keep getting Expression is invalid from the output preview. Any answers that I come across only really refer to python which I can't use.


enter image description here



Answer



The correct syntax involves the use of single quotes around the X and Y


'offset_x,offset_y'

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...