[Qgis-user] Rounding off QgsPointXY
Brent Wood
Brent.Wood at niwa.co.nz
Sun Feb 20 21:08:20 PST 2022
I'd suggest managing your data in Postgis.
Adding a rounded geometry to your dataset becomes a pretty simple sql (assuming your data is lat/lon - just change the SRID if it isn't):
alter table mydata add column rounded_geom geometry(POINT,4326);
update mydata set rounded_geom=ST_SetSRID(ST_MakePoint(round(ST_X(geom),2),round(ST_Y(geom),2)),4326);
line 1 creates the new column, line 2 populates it with new points with coords set to the rounded coords of the original. You still have the original to compare. Or you can drop it, as you prefer.
QGIS & Postgis make an incredibly effective suite. Postgis enables not just data management and query capability, but substantial spatial analytical power,
QGIS provides visualisation, as well as additional analytical tools.
Cheers
Brent Wood
Principal Technician, Fisheries
NIWA
DDI: +64 (4) 3860529
________________________________
From: Qgis-user <qgis-user-bounces at lists.osgeo.org> on behalf of Asim al-sofi <asim56 at gmail.com>
Sent: Sunday, February 20, 2022 14:03
To: QGIS User List <qgis-user at lists.osgeo.org>
Subject: [Qgis-user] Rounding off QgsPointXY
Hi everyone
I have a problem rounding off the QgsPointXY to say 3 decimals? How can I do that?
If I use the numpy.round(point,decimals) then I get an np.array back as a type and not a QgsPointXY.
Can someone help?
Kind regards
Asim
[https://www.niwa.co.nz/static/niwa-2018-horizontal-180.png] <https://www.niwa.co.nz>
Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529
National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz<https://www.niwa.co.nz> Facebook<https://www.facebook.com/nzniwa> LinkedIn<https://www.linkedin.com/company/niwa> Twitter<https://twitter.com/niwa_nz> Instagram<https://www.instagram.com/niwa_science>
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220221/06a75f4e/attachment.html>
More information about the Qgis-user
mailing list