<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<blockquote type="cite"><b style="color: rgb(0, 0, 0); font-family:
"Times New Roman"; font-size: medium; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">Klaus Mithöfer</b><span
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;"><span></span></span><br style="color:
rgb(0, 0, 0); font-family: "Times New Roman";
font-size: medium; font-style: normal; font-variant-ligatures:
normal; font-variant-caps: normal; font-weight: 400;
letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">
<i style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">Tue Jun 28 06:54:55
PDT 2022</i><span style="color: rgb(0, 0, 0); font-family:
"Times New Roman"; font-size: medium; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;"></span>
<hr style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration-thickness:
initial; text-decoration-style: initial; text-decoration-color:
initial;">
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">how the grid snapping work?
</pre>
</blockquote>
<br>
Hi Klaus,<br>
the QgsMapToPixelSimplifier Class [1] gives a hint about what the
"Simplify" algorithm "Snap to grid" method do:<br>
<br>
<blockquote type="cite">
<table class="fieldtable" style="font: 400 14px / 22px Roboto,
sans-serif; margin-bottom: 10px; border: 1px solid rgb(174, 217,
168); border-spacing: 0px; border-radius: 4px; box-shadow:
inherit; color: rgb(0, 0, 0); letter-spacing: normal; orphans:
2; text-align: start; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-thickness:
initial; text-decoration-style: initial; text-decoration-color:
initial;">
<tbody>
<tr style="transition-property: background-color, box-shadow;
transition-duration: 0.5s;">
<td class="fieldname" style="padding: 3px 7px 2px;
white-space: nowrap; border-right: 1px solid rgb(174, 217,
168); border-bottom: 1px solid rgb(174, 217, 168);
vertical-align: top;">SnapToGrid </td>
<td class="fielddoc" style="padding: 3px 7px 2px;
border-bottom: 1px solid rgb(174, 217, 168);">
<p style="font: 400 14px / 22px Roboto, sans-serif;
margin-top: 0px; margin-bottom: 2px;">The simplification
uses a grid (similar to ST_SnapToGrid) to remove
duplicate points.</p>
</td>
</tr>
</tbody>
</table>
</blockquote>
<br>
The code used for the "Snap to grid" method is at [2].<br>
<br>
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.<br>
<br>
Regards.<br>
<br>
Andrea Giudiceandrea<br>
<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="https://api.qgis.org/api/3.22/classQgsMapToPixelSimplifier.html#a0b97d82a3abd0876ce529ba9d9cfd412">https://api.qgis.org/api/3.22/classQgsMapToPixelSimplifier.html#a0b97d82a3abd0876ce529ba9d9cfd412</a><br>
[2]
<a class="moz-txt-link-freetext" href="https://github.com/qgis/QGIS/blob/e113457133fe5d7c3f5e3b90a2795b8b691ae269/src/core/qgsmaptopixelgeometrysimplifier.cpp#L183-L229">https://github.com/qgis/QGIS/blob/e113457133fe5d7c3f5e3b90a2795b8b691ae269/src/core/qgsmaptopixelgeometrysimplifier.cpp#L183-L229</a><br>
[3]
<a class="moz-txt-link-freetext" href="https://docs.qgis.org/3.22/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html?highlight=simplify#snap-points-to-grid">https://docs.qgis.org/3.22/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html?highlight=simplify#snap-points-to-grid</a>
</body>
</html>