Hi
Thank you all for your quick answers.
Regards
Johannes
Thank you all for your quick answers.
Regards
Johannes
Gesendet: Montag, 06. April 2020 um 12:51 Uhr
Von: "Bo Victor Thomsen" <[email protected]>
An: [email protected]
Betreff: Re: [QGIS-Developer] Intersections with Qgis
Von: "Bo Victor Thomsen" <[email protected]>
An: [email protected]
Betreff: Re: [QGIS-Developer] Intersections with Qgis
Johannes -
The actual intersection code can contain a pre-check of bounding box intersection. This will probably decrease computation time significantly for the check:
for i, geom_i in enumerate(geoms):
for j, geom_j in enumerate(geoms):
if j > i:
# Check bounding box first...
result = geom_i.boundingBoxIntersects(geom_j)
if result:
# Bounding box intersects, check actual geometry...
result = geom_i.intersects(geom_j)
# Do something with result...
-- Med venlig hilsen / Kind regards Bo Victor Thomsen
Den 06-04-2020 kl. 11:36 skrev Johannes Wildermuth:Hello developers
I've been currently working on a python plugin in which I have to find all possible intersections on one layer. I want to improve the efficiency of this task. It roughly looks like this:
for i, geom in enumerate(geoms):
for j, geom in enumerate(geoms):
if j > i:
//intersections
Is there a faster way? Perhaps with multithreading / rtree?
Regards
Johannes Wildermuth_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
