[Qgis-user] using field calculator to do a spatial update for a table using data from an overlapping geometry.

Damien Stephens Damien.Stephens at sandfire.com.au
Wed Oct 22 22:21:34 PDT 2014


HI
I have two tables, a point table and a polygon table. I want to be able to create a new field in the point table using data in a field in the polygon table.
Basically if a point is within a poygon I would like to return the value from polygon.value as a field in the point table, but am lost on the syntax of ;
A referring to the geometry of another table  and
B refering to a field of a nother table in the field calculator.

Here is roughly what I want to be able to do:

Case when within(polygontable,pointtable) =1 then polygontable.field else null end

My main questions are;
 can I just use the table names in the within function?
What is the syntax for referring to another tables' fields in the field calculator?

I know that what I want to do can be done using the "join attribute by location" tool, but I don't want to create a new table.

As an extra bonus..
Do I have to have both tables in the same CRS? IF so is there a way to convert the point table x and y cords to another crs in the field calculator then use that in the within  function?

Any assistance really appreciated.
Thanks
Damien

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20141023/c1ee2136/attachment.html>


More information about the Qgis-user mailing list