[Qgis-user] Check intersection of polygons and points with same value in ID field.

Tudorache, Marian Marian.Tudorache at navcanada.ca
Wed May 17 05:53:54 PDT 2017


You can extract the geometry from feature polygon and point and you perform a geometry intersection.

Here is a sample in python.

featurePolygon - pointer to feature polygon
featurePoint - pointer to feature point

polygonGeometry = featurePolygon.geometry()
pointGeometry = featurePoint.geometry()

if featurePolygon ["ID"] == featurePoint["ID"] and pointGeometry.intersect(polygonGeometry):
#Do whatever you need to do.
print pointGeometry.intersection(polygonGeometry)

Marian

-----Original Message-----
From: Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of sinorfavela
Sent: May-17-17 8:03 AM
To: qgis-user at lists.osgeo.org
Subject: [Qgis-user] Check intersection of polygons and points with same value in ID field.

Hi there!

I need to check if the features of a polygon shape intersect with the features of a points shape with share the same value in their ID field. In other word, if the polygon with ID "54" intersect with the point with ID "54" and so on with all the features.

¿Any idea? I guess that could probably made with the field calculator, but I cannot figure out how to build it.

Thanks in advance!



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Check-intersection-of-polygons-and-points-with-same-value-in-ID-field-tp5320809.html
Sent from the QGIS - User mailing list archive at Nabble.com.
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

________________________________

This electronic message, as well as any transmitted files included in the electronic message, may contain privileged or confidential information and is intended solely for the use of the individual(s) or entity to which it is addressed. If you have received this electronic message in error please notify the sender immediately and delete the electronic message. Any unauthorized copying, disclosure or distribution of the electronic message is strictly forbidden. NAV CANADA accepts no liability for any damage caused by any virus and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent contenir des renseignements privilégiés ou confidentiels destinés à l’usage exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez reçu ce message électronique par erreur, veuillez en informer l’expéditeur immédiatement et supprimez le. Toute reproduction, divulgation ou distribution du présent message électronique est strictement interdite. NAV CANADA n’assume aucune responsabilité en cas de dommage causé par tout virus ou autre programme malveillant transmis par ce message électronique.


More information about the Qgis-user mailing list