Snap the vertices and segments of the geometry to vertices of the reference.
Snap the vertices and segments of the geometry to vertices of the reference.Vertices and segments of the input geometry are snapped to vertices of the
reference geometry, returning a new geometry; the input geometries are not
modified. The result geometry is the input geometry with the vertices and
segments snapped. If no snapping occurs then the input geometry is returned
unchanged. The tolerance is used to control where snapping is performed.Where possible, this operation tries to avoid creating invalid geometries;
however, it does not guarantee that output geometries will be valid. It is
the responsibility of the caller to check for and handle invalid geometries.Because too much snapping can result in invalid geometries being created,
heuristics are used to determine the number and location of snapped
vertices that are likely safe to snap. These heuristics may omit
some potential snaps that are otherwise within the tolerance.Note: Sedona’s result may differ slightly from geopandas’s snap() result
because of small differences between the underlying engines being used.The operation works in a 1-to-1 row-wise manner:
We can also snap two GeoSeries to each other, row by row.
The GeoSeries above have different indices. We can either align both GeoSeries
based on index values and snap elements with the same index using
align=True or ignore index and snap elements based on their matching
order using align=False: