[Qgis-user] Update field based on a value from another layer

Harrissou delazj at gmail.com
Tue Jun 23 23:00:51 PDT 2020


Hi Tony,

You can use functions from the aggregate group in the field calculator of the point layer. No need to create a third layer. (Somehow) Picked from the QGIS function help panel

aggregate ( layer:='yourpolygonlayername', aggregate:='concatenate', expression:="yourfieldtoextract", filter:=contains($geometry, geometry(@parent)))

This will populate the point layer field with values of whatever polygon covers the point.
You can also use the direct functions concatenate, concatenate_unique, minimum, maximum... depending on how your data are shaped and what you actually need.

Hope that helps,
Harrissou

Le 24 juin 2020 05:29:58 GMT+02:00, "Tony Shepherd (FarmMaps NZ)" <tony at farmmaps.nz> a écrit :
>Hi All
>
> 
>
>Am I missing something?  Is there a simple point and click tool in QGIS
>to
>update an existing field in a QGIS layer based on a value in another
>using a
>geographic join?  For example a series of points and a series polygons.
> I
>want to update a field in points from a value in a field in polygons
>based
>on which polygon the point falls in.  Simple stuff.
>
> 
>
>In a previous life using MapInfo we simply used query editor and
>
>update point_layer set col1 = colx from polygon_layer where obj within
>any
>
> 
>
>To me, this seems like a very simple everyday thing to do to an
>existing
>table.  I can, of course, use vector -> Join Attributes by Column but
>why in
>this case would I needlessly complicate things by having to create a
>third
>layer?  I don't need an extra layer, I just need to update the one I
>have
>already.
>
> 
>
>I can see that the internet is littered with similar questions dating
>back
>as long as QGIS has been around.  Perhaps I have missed something
>obvious,
>and if so apologies for wasting the time of others, but can you point
>me to
>the tool?
>
> 
>
>Cheers
>
>Tony
>
> 
>
>Tony Shepherd  |  GeoSpatial / Mapping Manager
>
>Ph 027 435 6193  |  E  <mailto:tony at farmmaps.nz> tony at farmmaps.nz
>
>FarmMaps NZ, 3 Kerwood Place, Gore 9740
>
> 
>
>
>
> 
>
> 
>
> <http://tonyshepherd8.wixsite.com/home>
><https://www.wunderground.com/personal-weather-station/dashboard?ID=ISTLGORE
>2> 
>
> 

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200624/d1bad18c/attachment.html>


More information about the Qgis-user mailing list