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

enricofer enricofer at gmail.com
Thu Oct 23 03:13:32 PDT 2014


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.



More information about the Qgis-user mailing list