[Qgis-user] Simplify geometry - snap to grid

Thayer Young thayeray at yahoo.com
Wed Jun 29 07:29:04 PDT 2022


 Hi Klaus and Patrick, 

With respect to 'Snap to grid', I would like to chime in that the grid is usually meant to be quite fine. For example, on a scale smaller than meter or a foot. In the case of the 'Simplify' tool, set to 'Snap to grid', this is controlled by the 'Tolerance', you will note that the units change according to the CRS units of the selected layer. It is frequently used to snap points and lines together for use with networks. Because, while your line file may look like the nodes are all connected to each other, in actuality they may be off by a few milli-, micro- or nanometers so the routing tool will see this as the two lines not being connected. You can increase the Tolerance upwards and give your vector a pixelated look to it.

Just a guess, I would presume the layer's bounding box is used to set the grid. If that is not enough of an explanation please do look up the code references given by Andrea (I have left them inline below). 

-Thayer


    On Wednesday, June 29, 2022 at 08:29:23 AM EDT, qgis-user-request at lists.osgeo.org <qgis-user-request at lists.osgeo.org> wrote:  
 > 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 
> 
> ------------------------------
> Date: Wed, 29 Jun 2022 11:57:47 +1200
> From: Patrick Dunford <enzedrailmaps at gmail.com>
> To: qgis-user at lists.osgeo.org
> Subject: Re: [Qgis-user] Simplify geometry - snap to grid
> Message-ID: <62ff8391-0f43-92ae-5c11-c324f2bafb8e at gmail.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Is this the grid you see in View -> Decorations -> Grid ?
>
> On 29/06/22 07:50, Delaz J via Qgis-user wrote:
> Hi Klaus,
>
> Just a guess: the only snap to grid thing I know about is 
> https://docs.qgis.org/3.22/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html#snapping-on-custom-grid. 
> Worth a check?
>
> Regards,
>
> Harrissou
>
> Le 28/06/2022 ? 15:54, Klaus Mith?fer via Qgis-user a ?crit?:
>> hello,
>>
>> with the simplify tool in QGIS you can simplify geometries using 
>> either ?Douglas-Peucker Algorithm, Visvalingam-Algorithm or snap to 
>> grid. I understand the algorithms, but how the grid snapping work? 
>> Where is is the grid defined? I don't get that point. maybe someone 
>> can explain.
>>
>> Thanks an kind regards
>> Klaus

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220629/75f72ef1/attachment.htm>


More information about the Qgis-user mailing list