<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
True! Sorry I was just eager to get some help. The code is probably not so good, we are just learning with my dev which makes it a bit more interesting the questions. This used to work a few weeks ago maybe 2-3 weeks.</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
for feat in point_layer.getFeatures():</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
geom = feat.geometry()</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
if point_crs != project_crs:</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
geom = geom.clone()</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
geom.transform(transform_point_to_project)</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
if surface_geom.intersects(geom):</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
new_feat = QgsFeature(feat)</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
new_feat.setGeometry(geom)</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
provider.addFeatures([new_feat])</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
result['features'].append(new_feat)</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
result['count'] += 1</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Then I tried this and I get that clone() is not available</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="direction: ltr; text-align: left; text-indent: 0px; margin-top: 0px; margin-bottom: 16px; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
geom = QgsGeometry.fromWkt("POINT(0 0)")<br>
try:<br>
cloned = geom.clone()<br>
print("clone() is available:", type(cloned))<br>
except AttributeError:<br>
print("clone() is NOT available on QgsGeometry")</div>
<div class="elementToProof" style="direction: ltr; text-align: left; text-indent: 0px; margin-top: 0px; margin-bottom: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
clone() is NOT available on QgsGeometry</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So we have found an alternative but still wondering what we had wrong to avoid in the future.</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Nyall Dawson <nyall.dawson@gmail.com><br>
<b>Sent:</b> Sunday, June 29, 2025 7:44 PM<br>
<b>To:</b> Antonio Locandro <antoniolocandro@hotmail.com><br>
<b>Cc:</b> qgis-developer@lists.osgeo.org <qgis-developer@lists.osgeo.org><br>
<b>Subject:</b> Re: [QGIS-Developer] use of clone</font>
<div> </div>
</div>
<div>
<div dir="ltr"><br>
<br>
On Sun, 29 Jun 2025 at 03:08, Antonio Locandro via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> wrote:<br>
><br>
> Hello all!<br>
><br>
> I had a script that used copy_geom = geom.clone() and worked until today that I updated QGIS.
<div><br>
</div>
<div>> Any thoughts?
<div><br>
</div>
<div>Yes -- "it used to work" is not useful information at all! 🤪</div>
<div><br>
</div>
<div>Describe the actual error, including exception messages if appropriate. Include sample code so that we actually have some idea of what you're talking about. And never, EVER just tell developers "it doesn't work" without providing an excessive level of
detail. 😜</div>
<div><br>
</div>
<div>Nyall</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
> _______________________________________________<br>
> QGIS-Developer mailing list<br>
> <a href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" originalsrc="https://lists.osgeo.org/mailman/listinfo/qgis-developer">
https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" originalsrc="https://lists.osgeo.org/mailman/listinfo/qgis-developer">
https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div>
</div>
</div>
</div>
</body>
</html>