[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
Thu Oct 23 22:50:06 PDT 2014


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



More information about the Qgis-user mailing list