Geometric
geometric
¶
Functions¶
angle_between(v1, v2)
¶
Returns the angle in radians between vectors 'v1' and 'v2'::
angle_between((1, 0, 0), (0, 1, 0)) 1.5707963267948966 angle_between((1, 0, 0), (1, 0, 0)) 0.0 angle_between((1, 0, 0), (-1, 0, 0)) 3.141592653589793
Source code in geograypher/utils/geometric.py
batched_unary_union(geometries, batch_size, grid_size=None, subsequent_batch_size=4, sort_by_loc=False, simplify_tol=0, verbose=False)
¶
Roughly replicate the functionality of shapely.unary_union using a batched implementation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
geometries |
List[Geometry]
|
Geometries to aggregate |
required |
batch_size |
int
|
The batch size for the first aggregation |
required |
grid_size |
Union[None, float]
|
grid size passed to unary_union |
None
|
subsequent_batch_size |
int
|
The batch size for subsequent (recursive) batches. Defaults to 4. |
4
|
sort_by_loc |
bool
|
Should the polygons be sorted by location to have a higher likelihood of merging. Defaults to False. |
False
|
simplify_tol |
float
|
How much to simplify in intermediate steps |
0
|
verbose |
bool
|
Should additional print outs be provided |
False
|
Returns:
Type | Description |
---|---|
MultiPolygon
|
shapely.MultiPolygon: The merged multipolygon |