5

I need a way to quickly copy coordinates under mouse to paste them to external program (3D reconstruction software I use for making maps from photos).

I see the coordinates within status bar at bottom of the screen; my hack of getting what I want right now is to:

  1. Place mouse over the place you want coordinates of
  2. Press Alt-tab to switch to another full-screen application
  3. Now you can move the mouse without changing coordinates in QGIS; get mouse to the bottom of the screen, outside of map area
  4. Alt-tab back to QGIS
  5. Copy the coordinates from the fields at bottom, be very careful not to get the mouse over the map or the coordinates will get updated

So this works, but is a bit annoying. Is there a better way? When I try to google this, I'm getting articles on "Coordinate Capture" Plugin. But it doesn't seem to be present in current versions of QGIS.

10

For QGIS versions lower than QGIS 3.14

Previously in QGIS it was possible by means of the "Coordinate Capture" Plugin (firstly it was a Plugin, then it became a Core Plugin). There are some threads on this particular topic: Coordinate Capture in QGIS 3.0 and How to turn the QGIS "Coordinate capture" plugin on?.

plugin_gui

For QGIS versions QGIS 3.14 and higher

Nowadays the functionality of this Plugin has been added as a map toolkit in QGIS 3.14, see this issue on the GitHub for more details.

So, simply RMC the map canvas > Copy Coordinate..., see the image below

result

and get a pair of your coordinates as 9.115780774,48.813284425.

1
  • 1
    I was using v3.5, which seem to be the version which doesn't have the plug-in already, but the RMB click didn't do anything yet. I switched to latest and now the right click does work! – mefistotelis Apr 29 at 12:50
6

Use this script in QGIS Python Editor. It copies the coordinates under the cursor to clipboard, then you can paste them to other application.

class CopyCoordinatesTool(QgsMapTool):
    def __init__(self, iface):
        QgsMapTool.__init__(self, iface.mapCanvas())
        self.canvas = iface.mapCanvas()
    
    def activate(self):
        self.canvas.setCursor(Qt.ArrowCursor)

    def canvasMoveEvent(self, e):
        crs = self.canvas.mapSettings().destinationCrs()
        x = e.pos().x()
        y = e.pos().y()
        p = self.canvas.getCoordinateTransform().toMapCoordinates(x, y)
        
        c = QApplication.clipboard()
        c.setText(f"{p.x()}, {p.y()}\n")

map_tool = CopyCoordinatesTool(iface)
iface.mapCanvas().setMapTool(map_tool)

Demo:

enter image description here

3

If you need to transform the coordinates (like swapping X and Y, using a specific CRS, using a specific format etc), or if you need to capture an extent, you can use the lat lon tools plugin.

Once the tool is selected, each time you (left) click on the map the mouse coordinates is copied to the clipboard.

1
  • Wow ... never heard of this useful Plugin. Thank you for new information! – Taras Apr 29 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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