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

2014-10-28 Thread Järnefelt Jouko
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-boun...@lists.osgeo.org 
[mailto:qgis-user-boun...@lists.osgeo.org] Puolesta Damien Stephens
Lähetetty: 24. lokakuuta 2014 8:50
Vastaanottaja: enricofer; qgis-user@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-boun...@lists.osgeo.org 
[mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of enricofer
Sent: Thursday, 23 October 2014 6:14 PM
To: qgis-user@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 10 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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


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

2014-10-23 Thread Damien Stephens
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-boun...@lists.osgeo.org 
[mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of enricofer
Sent: Thursday, 23 October 2014 6:14 PM
To: qgis-user@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 10 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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


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

2014-10-23 Thread enricofer
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:

 

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 10 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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


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

2014-10-22 Thread Damien Stephens
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

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user