0

I have a point layer and a line layer in my QGIS project (QGIS 3.0.3). I want to add a point to the point layer at the intersection of two lines in my line layer. I toggle editing for the point layer, select "add point feature", locate the cursor on the intersection and left click.

I get a dialog box for the point with three fields: EAST, NORTH, and ID. I type in the ID, without typing in the EAST and NORTH coordinates because they are 12 significant figures and therefor are HARD to type in. Furthermore, the numbers in the "coordinate" display at the bottom of the screen move around constantly even though I have already fixed the point by clicking on the position I want it at. SO, I put in the ID (simple) and click OK. The point, with the ID, displays right where I want it to be. Great!

Having created my point, I then SAVE LAYER EDITS. Immediately my point DISAPPEARS! When I open the attribute table for the layer, the point is listed with NULL / NULL for X and Y. And there is no point on the layer display, even though there was one before I clicked SAVE LAYER EDITS.

How do I get QGIS "Add Point Feature" to AUTOMATICALLY post the X and Y values automatically into the attribute table since I have already indicated the coordinates by clicking on the position where the point is to be placed? Or automatically into the dialog box, instead of leaving them NULL?


The answer to the question "Update point coordinates in QGIS after manually moving locations in edit mode" does not answer this question. At the time that a point is CREATED (not moved) a dialog box is presented that requests that the X and Y (EAST and NORTH) coordinates be entered. Since QGIS knows the X and Y (EAST and NORTH) coordinates at that point, I want to find an easy way to put those values into the dialog. That is not what the other question is about, nor does it have an answer that would work in this context.

0

"Add feature" function of QGIS does not support your "custom" demand. But I think you can do this by two methods.

first, makes custom QGIS plugin which assists your custom editing demand. "this plugin" will have two parameter i. e. one polyline layer and one point layer. when you click near an intersection, the plugin will search the nearest intersection of polyline layer and calculate the precise intersection position and convert it to the spatial reference system of point layer and copy these(x and y value) to new feature 's "EAST" and "NORTH" field.

second, you can do this by executing one custom module. this module will search all possible intersections in polyline layer and for each intersection, generates new point feature and add it to point layer. In my case, it looks rather easy.

https://www.youtube.com/watch?v=bB3-XyShbA0

0

Thanks go to user csk who wrote....

The feature you're looking for is called a "default field value." This feature was introduced in QGIS version 2.18.

To get the EAST / NORTH fields to be automatically populated with the X and Y values of the point when the point is added, a little set-up is required. You must add the default values you want to the field's properties:

  • Select the layer in the "layer panel" and left-click.
  • Select "Properties" from the context menu. The Properties dialog will be displayed. See screen shot below.
  • Select the "Attributes Form" category from the properties category list.
  • Select the field of interest from the "Fields" list under the "Available Widgets" In this case, we are setting up the default value for the EAST field.
  • Under "Defaults" set the default value. We are using the $x value of the point, it's X coordinate. In this case we will do the same for "NORTH" using the $y value for the Y coordinate.

Set Field Default Value QGIS 3.0.3

NOW when you "Add Point Feature" and left-click, you get the following dialog with the EAST / X coordinate and the NORTH / Y coordinate already populated with the new points value! (I'm so excited! :) )

Add Point Feature Feature Attributes Dialog

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.