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

Järnefelt Jouko Jouko.Jarnefelt at tampere.fi
Tue Oct 28 06:57:28 PDT 2014


Hi,

Enrico: Nice work I have to say! I think this kind of functionality should be part of the QGIS core. Or atleast I'm missing a way to do "join attributes by location" kind of task in processing toolbox as well as in geographical modeler. 

Cheers,
Jouko

-----Alkuperäinen viesti-----
Lähettäjä: qgis-user-bounces at lists.osgeo.org [mailto:qgis-user-bounces at lists.osgeo.org] Puolesta Damien Stephens
Lähetetty: 24. lokakuuta 2014 8:50
Vastaanottaja: enricofer; qgis-user at lists.osgeo.org
Aihe: Re: [Qgis-user] using field calculator to do a spatial update for a table using data from an overlapping geometry.

Enrico you have made my day  ! - much appreciated.
I will have a look at it and get back to you on how I progress.
Thanks Again
Damien

-----Original Message-----
From: qgis-user-bounces at lists.osgeo.org [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of enricofer
Sent: Thursday, 23 October 2014 6:14 PM
To: qgis-user at lists.osgeo.org
Subject: Re: [Qgis-user] using field calculator to do a spatial update for a table using data from an overlapping geometry.

You are lucky.
I was developing a plugin with reference functions that fits to solve similar problems.
I see your question and I implemented a dbwithin function You can get a development version from github:
https://github.com/enricofer/refFunctions/archive/master.zip

put the inside directory refFunctions-master in your plugin directory (typical .qgis/python/plugins in your user profile directory if you work in
windows)
then restart qgis

If everything ok you will find under field calculator dialog a new group of experimental  functions called 'reference' with a function dbwithin:

<http://osgeo-org.1560.x6.nabble.com/file/n5169107/reffunc.png> 

Syntax
dbwithin(targetLayer,targetField)

Arguments:
targetLayer; the name of a currently loaded layer, for example 'myLayer'.
targetField; a field in target layer we want as result when source feature is within target feature, for example 'myField'. If targetField is equal to '$geometry' The WKT geometry of targetFeature willbe retrieved
        
Number of feature tested is limited to 100000 to avoid time wasting loops
        
Example:
dbwithin('targetLayer','TargetField')
dbwithin('targetLayer','$geometry')

Let me know if that resolvs

PS: Qgis guys are releasing 2.6 version that contains some new expression funtions very very interesting for you......

Bye.

Enrico





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/using-field-calculator-to-do-a-spatial-update-for-a-table-using-data-from-an-overlapping-geometry-tp5169056p5169107.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list