[OSGeo Africa] QGIS Field Calculator - attributes for 2 layers

David Barkhuisen dave at kirchhoffsurveyors.co.za
Fri Jul 8 07:07:43 PDT 2016


Hi Tim, Zoltan

Just a quick one with the query below.

Will it not be easier to move both tables into postgis db.
Add empty lat and long columns to B then using SQL update the table to 
pull the data from A to B
something like:

UPDATE B
SET B.long = A.long
         B.Lat = A.lat

 From A
JOIN B
ON ST_Intersects(A.geom, B.geom)

Would that not be an easier method?

Regards
David


On 08/07/2016 12:37, Tim Sutton wrote:
> Hi
>
>> On 08 Jul 2016, at 11:30 AM, Zoltan Szecsei <zoltans at geograph.co.za 
>> <mailto:zoltans at geograph.co.za>> wrote:
>>
>> Hi again,
>> OK - it's not an index thing. More than one 'a' polygon has received 
>> the 'b' attribute from the wrong 'b' polygon even though the 
>> coordinate is inside the correct 'b' polygon.
>>
>> So the next step is to suspect the index.intersects result.
>
> Could you share a small testable dataset that replicates it? I made a 
> noddy test dataset here when playing with it last night which worked 
> fine, but it only had 2 polygons in it...
>
>> Note the coords are in LatLong  "small numeric values. I can see we 
>> are using a null-length box (ie: a point) to select from 'b'.
>> What is the internal precision of the QgsPoint?
>
> the x and y properties of QgsPoint are both doubles...it depends on 
> your platform what that means but typically
>
> http://qgis.org/api/2.6/classQgsPoint.html
>
> According to wikipedia on a 64 bit machine it should be:
>
>   * Sign bit <https://en.wikipedia.org/wiki/Sign_bit>: 1 bit
>   * Exponent <https://en.wikipedia.org/wiki/Exponent> width: 11 bits
>   * Significand <https://en.wikipedia.org/wiki/Significand> precision
>     <https://en.wikipedia.org/wiki/Precision_%28arithmetic%29>: 53
>     bits (52 explicitly stored)
>
>
>
>
>> My coord attributes are 'double Real 19,10'
>>
>> In a script, when you select with a point, what is the snapping 
>> tolerance?
>
> To use snapping you would need to use the QGIS snapping api - 
> otherwise absolute geometry operations are being done.
>
>> My project CRS is epsg 4326 - so it should be OK.
>
> Yup. If you wanted to be fancy, you could extract a layer of the tie 
> points (FptnLat. FptnLong) so that you can actually visualise the 
> points in relation to the polygons. Maybe you have some that don't 
> actually intersect a poly...
>
>>
>> FWIW, b.name is string 60 which is copied into a.name string 32  -  
>> but the contents are shorter that 32 chars.
>
> I think QGIS will just truncate it if the name is longer than 32 chars.
>
> T
>
>>
>> Any thoughts anyone?
>>
>> Regards,
>> Zoltan
>>
>
>
>
> _______________________________________________
> Africa mailing list
> Africa at lists.osgeo.org
> You can UNSUBSCRIBE at http://lists.osgeo.org/mailman/listinfo/africa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/africa/attachments/20160708/fea5745a/attachment.html>


More information about the Africa mailing list