<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 2/19/2022 6:03 PM, Asim al-sofi
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANUs6XCy928STmk_Jm=ASuaaMvN73Ntu+xPsMQ9RPysncogE6w@mail.gmail.com">Hi
everyone
<div>I have a problem rounding off the QgsPointXY to say 3
decimals? How can I do that?</div>
<div>If I use the numpy.round(point,decimals) then I get an
np.array back as a type and not a QgsPointXY.</div>
<div>Can someone help?<br>
Kind regards</div>
<div>Asim</div>
</blockquote>
<br>
what are you trying to achieve? Keep in mind that in general decimal
fractions do not have exact representations in floating point, so if
you round a coordinate to 3 decimals, store it somewhere, then print
it, there will almost certainly be more than three numbers past the
decimal point. If it's the printed representation of the number that
matters, deal with it in the formatting of the printed
representation.<br>
<br>
That said, you set() method of QgsPointXY to set the values to their
rounded values. If my_pt is a QgsPointXY, then<br>
<br>
my_pt.set(round(my_pt.x(), 3), round(my_pt.y(), 3))<br>
<br>
<br>
</body>
</html>