5

I am trying to export the centrum coordinates of the current map in the print layout, and show the coordinates as a text element.

I have succeeded to print the centrum coordinates of a geometry in the in the map when using the atlas tool, i.e. x( @atlas_geometry ), and y( @atlas_geometry ). The result shows like the image below.

enter image description here

But I would like to print the center coordinates of the current map, without having to use the atlas tool. I guess I will have to change the @atlas_geometry to something similar to map_get(), but I can't get it to work. Any ideas how I can solve this?

1 Answer 1

7

you can use the following statement, assuming that you map in the mapcomposer has the id: map1. the example below gives you the x coordinate

x(map_get(item_variables('map1'), 'map_extent_center'))

enter image description here

1
  • Thank you so much for the answer! It worked perfectly!
    – Palemon
    Oct 25, 2018 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.