1

I was looking for a case to easily add points to a layer from coordinates. I my case I often want to quickly add one or a few points manually to an existing layer. I have seen an occasional reference that it would be possible to paste it directly into a layer. It would fit perfectly in my workflow to copy some coordinates in an external application e.g. google maps/osm to paste (ctrl-v) into an existing layer. So I tried pasting the syntax in the two CRS used in my current file:

  • "point(571287,6799222)" (CRS: New Amersfoort)
  • "point(48.0578195,7.2497044)" (CRS: WGS84)

Than QGIS prompts that features are pasted succesfully:

Paste features: 1 features were successfully pasted

The problem is that indeed a extra row is added to the table, but no coordinates are actually added. Also when I 'extract' the coordinates in the table field calculator with the functions $x adn $y it appears as null instead of points added in a different way and which are showing or giving an output : enter image description here

I guess there is something wrong in the syntax but I coul not find any references or guides on what syntax QGIS is expecting. Is there somebody who can provide more background on how this features is supposed to work?

P.s. I know there are different ways of getting points of exact coordinates into Qgis. My question is that apparantly this low-key workflow is supposed to work and I cannot figure out how or found any more info on this.

  • 1
    Could you either describe the workflow in more detail, or add a reference to your question, so we can have a better look? Also: Should it be "now coordinates" or "no coordinates"? – Erik Aug 12 at 7:03
  • So you copy some coordinates in textform and paste them into a shapefile layer in QGIS? – Erik Aug 12 at 11:23
  • yes indeed, in Qgis 2.x a plugin was needed for that and apparantly in Qgis 3.x it could be done directly but I seem not to get the right syntax – JosE Aug 12 at 11:30
  • What exactly happened in QGIS 2.X, when you used the plugin? – Erik Aug 12 at 11:36
  • in Qgis 2.x you had to privide the coordinates separated by a comma (,) and than the point was added. But for Qgis 3.x the work as described by Andreas Muller below is supposed to work. – JosE Aug 12 at 12:10
0

For me it works with the following steps:

  • create a new layer, i tried the scratch layer, also it should be possible to load an existing layer
  • make sure it is editable
  • copy the coordinate (ctrl-c), i tried the WKT-Format, eg.: POINT (30 40) and paste it into the QGIS window (ctrl-v). Always use a blank as seperator.
  • look into the table and or zoom to layer, so see the new entry
  • save the changes
  • And where do you paste the coordinate? – Erik Aug 12 at 11:47
  • I used copy and paste (ctrl-c and ctrl-v), pasted it in to the QGIS window, which must be active, to receive the paste command. I am on windows, if that may matter? Updated my answer... – Andreas Müller Aug 12 at 11:52
  • I can confirm, that pasting an uncompatible format wil create a feature without any data and qgis displays that "features were succesfully pasted". So try the points without Quotation Marks and crs. – Andreas Müller Aug 12 at 11:58
  • Are capitals necessary, or does it not matter if you write point or POINT? – Erik Aug 12 at 12:02
  • Both works, initially i used lowercase, but uppercase works too – Andreas Müller Aug 12 at 12:04
0

If you want attributes to be automatically filled when you paste a feature into QGIS, use a default field value.

  1. open layer properties > attributes form
  2. check the box for "Apply default value on update"
  3. enter the appropriate expression (eg $x or $y) into the default value text box

The method is explained in more detail (with screenshots) here: How to set a default value for attributes in shapefiles? It's from an older version of QGIS but this feature hasn't changed.

You might need to save your edits to the layer for the change to be displayed. You might also need to close the attribute table and open it again before you see the field values.

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.