[Qgis-user] Simplify geometry - snap to grid

Andrea Giudiceandrea andreaerdna at libero.it
Tue Jun 28 14:21:22 PDT 2022


> *Klaus Mithöfer*
> /Tue Jun 28 06:54:55 PDT 2022/
> ------------------------------------------------------------------------
> how the grid snapping work?

Hi Klaus,
the QgsMapToPixelSimplifier Class [1] gives a hint about what the 
"Simplify" algorithm "Snap to grid" method do:

> SnapToGrid 	
>
> The simplification uses a grid (similar to ST_SnapToGrid) to remove 
> duplicate points.
>

The code used for the "Snap to grid" method is at [2].

Another algorithm that snaps the vertex to a grid is the "Snap points to 
grid" [3], but this doesn't actually simplify the geometries, just 
simplifies the coordinates of the geometries.

Regards.

Andrea Giudiceandrea


[1] 
https://api.qgis.org/api/3.22/classQgsMapToPixelSimplifier.html#a0b97d82a3abd0876ce529ba9d9cfd412
[2] 
https://github.com/qgis/QGIS/blob/e113457133fe5d7c3f5e3b90a2795b8b691ae269/src/core/qgsmaptopixelgeometrysimplifier.cpp#L183-L229
[3] 
https://docs.qgis.org/3.22/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html?highlight=simplify#snap-points-to-grid 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220628/b4c61da8/attachment.htm>


More information about the Qgis-user mailing list