I have 1000 points in QGIS.

I want to move them one by one and I want to know which of those I have already moved.

I want to change style of point that I moved before.

How can I do that?

  • you can try to style them playing with the function now().
    – matteo
    Commented Feb 3, 2021 at 7:40
  • I dont know what is it?Can you help me?@matteo
    – saeedzali
    Commented Feb 3, 2021 at 7:41

5 Answers 5


Before moving your points create a field each for the x and y coordinates using the $x and $y functions called something like "original_x" and "original_y"

Then in the layer symbology create a rule based symbology and add a feature with this rule:

("original_x" || "original_y" <> $x || $y)

Then also add a second feature with the rule set to Else (this is for features which have not been moved).

  • thanks a lot Can you give me some pictures where can i write above rule and add some column to my shapefile @TeddyTedTed
    – saeedzali
    Commented Feb 3, 2021 at 8:05
  • also a good solution :) @Babel you can choose to compare you points on coordinates or on timestamps
    – matteo
    Commented Feb 3, 2021 at 9:24

One possibility: Hardcode the current coordinates into the attribute table as integer fields using $x and $y. Then set the data defined override of the fill colour of the points to if((round($x) NOT LIKE "column with your old x-coordinate" OR round($y) NOT LIKE "column with your old y-coordinate"),'green','red')

If the point has been moved, it will be green, if it hasn't, it will be red.

  • thanks a lot Can you give me some pictures where can i write above rule and add some column to my shapefile @Erik
    – saeedzali
    Commented Feb 3, 2021 at 8:02
  • This is no rule, this is what you set as variable under data defined override next to the fill colour field in the symbology @saeedzali
    – Erik
    Commented Feb 3, 2021 at 8:11

Maybe there are more straightforward ways, but this is working.

  1. Create 2 datetime fields in your vector layer (ts and ts2) in the example. Update the values so that each field contains the same timestamp (using the now() function):

enter image description here

  1. update the ts columns so that it has the same exact values of the ts2 field:

enter image description here

  1. in the attribute form, set the Default value of ts to now() and check the Apply default value on update. This means that the ts column will be updated with the now() current datetime when you both add a new point or when you update an existing point.

enter image description here

enter image description here

  1. do the same for ts2 but just subtract one second. When you add a point ts2 will be always 1 second smaller than ts:

enter image description here

  1. Add a Rule based style with the first rule comparing ts and ts2: when ts is > than ts2 apply a custom style. Just add a second ELSE rule:

enter image description here

So now if you update an existing point or add a new one, ts is always > than ts2 and the rule will behave correctly.

Hope this helps


The idea To apply a different style to points you have moved, create two new attributes: initial_coordinate (normal field) and current_coordinate (virtual field). Than set a Rule based style (symbology), the rule comparing if the two coordinates are equal or not.

The implementation Before moving, create a new attribute field with field calculator for the coordinates, using the expression $x / $y for x and y coordinates.

You might use just one of the coordinates: when you move points manually, it will be almost impossible to keep the original value of one of the both coordinates. But you could also do it for both coordinates or you could concatenate x and y coordinates in one field. In what follows, I use just the x coordinate for demonstration purpose.

Than again create a new field, but this time be sure to create a virtual field - a field that is updated dynamically. Again use $x to generate the value of the respective coordinates.

Now, set the style of the layer to rule base and create two rules: "initial_x" = round ("current_x" ,3) for points. Be aware: in my case, somehow the inital_x field had just 3 decimals, whereas the virtual field contained more digits, so even unmoved points did not have the same value. For this, I had to apply a round function.

Copy the style and change the rule to by switching = with <> and assigning a different style (like a different color).

When you now move points, they will automatically change their style, whereas the unmoved points will keep the initial style.

Screenshot: rule based style with white dots (unmoved) and red dots for moved points. enter image description here


Building on the other answers based on a comparison with a stored original location, you can make QGIS do more of the work for you:

  1. In Layer properties / Fields use the field calculator (abacus icon) to create a new field, say called OrigLocation, type text, with the expression geom_to_wkt($geometry). This encodes the current location as a string including both x and y. Click Apply or OK to save this new field.

  2. Again go to Layer properties / Fields and use the field calculator to create a new field Moved?, but this time with create virtual field selected, type integer, with expression geom_to_wkt($geometry)="OrigLocation". This will compare the current geometry with the saved original geometry, spit out 1s when equal and 0s when not, and keep it up to date at all times. In contrast, in the previous step, we did not make it a virtual field, so the geometry was saved in its then-current state.

  3. Now either use the Categorized renderer to define different points based on whether Moved? is 0 or 1. Or, if you prefer, keep your original symbology and use a data-driven override based on "Moved". Example: you could use if("Moved?",'#ff0000','#00ff00') to make a color red if moved and green if not. Or, add another symbol layer (e.g. another circle around the point, or a draw effect) as a data-driven override.

Meta-comment: Other answers are already suggesting using a comparison with a saved initial location. What's tweaked here is the use of only one field rather than x and y separately; putting the comparison logic in the virtual field definition rather than in a rendering rule; and then using the categorized renderer and/or data-driven overrides for specific elements of the symbology rather than a rule-based renderer.

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.