[Qgis-user] Point data with no co-ordinates

Jeffrey Durrence jeffrey.durrence at mcleanengineering.com
Tue Sep 22 06:03:10 PDT 2020


Hi Warren,

I'm making these assumptions
1 - your vector layer has an existing geometry field
2 - your vector layer has additional attributes easting and northing that can be used to store the X and Y components of the coordinate pair for each point.
3 - The vector layer's coordinate reference system matches what is expected to be reflected in the easting and northing coordinate pairs.
4 - your newly created points appear on the map canvas (meaning that they do have valid geometries), but the easting and northing attributes are not populated.

If these assumptions are correct, then your underlying data storage has no mechanism to populate the easting and northing attributes whenever a new point is created.  For the same reason, moving a point on the map canvas will not update the easting and northing attributes.  It is possible to create this behavior with database triggers if your underlying storage is something like PostGIS.  Without that, you are left with the responsibility to populate and/or update these fields on your own.

The field calculator feature of QGIS is probably the most common way to do this.  This tool, available from the default QGIS toolbar or the attribute table toolbar has the ability to update existing fields (as well as other abilities that are outside of the scope of your question).  In your case, you would use a built-in QGIS to update the easting and northing fields (you would do this as two separate steps).  You could do this for select group of your layer's records (like those with NULL values for easting and northing) or for the entire layer -- those options are available in the Field Calculator interface.

In your case, you would specify in the Field Calculator interface that you are going to update the easting field.  In the "Expression" area of this interface, you will put the expression that produces the calculated result that you desire.  The middle area of this form has a long categorized list of things that can be used in your expression.   Under the Geometry category, you will find that there are "built-in" helps for your situation.  For the easting calculator, you simply choose $x (choose it from the list or type it into the Expression area).  There is an output preview in the lower-left corner of the screen that should help you decide if this is the right result for you.  This would not work if the the coordinate reference system of the vector layer is "different" than what is expected in the easting and northing fields.  In that case, you would need to transform the record's geometry into the desired coordinate system before extracting the easting from the converted result.  The Field Calculator can do that using a combination of geometry functions, but try the simple case first.

After you get the easting updated, you would do the same for northing(using $y instead of $x) .

Hopefully my assumptions were reasonable and this can at least get you started in the right direction.

Jeffrey

--
Jeffrey Durrence
jeffrey.durrence at mcleanengineering.com
McLean Engineering Company
815 South Main Street
Moultrie, GA  31768
1.229.985.1148 (Voice)
1.229.985.2248 (FAX)
1.229.798.0480 (Mobile)


Date: Tue, 22 Sep 2020 01:52:25 +0000
From: Warren Thorne <Warren.Thorne at mrl.com.au>
To: "qgis-user at lists.osgeo.org" <qgis-user at lists.osgeo.org>
Subject: [Qgis-user] Point data with no co-ordinates
Message-ID: <fab694fbebeb4a29a0df7559d8c9239c at mrl.com.au>
Content-Type: text/plain; charset="utf-8"

Hi All,

I have created numerous points with a vector layer, and the points appear not to have northing and eastings.

How do I rectify this?

Thanks in advance



Warren Thorne


More information about the Qgis-user mailing list