Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
05d83a0e
Commit
05d83a0e
authored
Mar 21, 2019
by
Daniel Scheffler
Browse files
Fixed linting.
parent
1448fe50
Changes
1
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/vector/topology.py
View file @
05d83a0e
...
...
@@ -15,7 +15,7 @@ __author__ = "Daniel Scheffler"
def
get_overlap_polygon
(
poly1
,
poly2
,
v
=
False
):
""" Return
s
a dict with the overlap of two shapely.Polygon() objects, the overlap percentage and the overlap area.
""" Return a dict with the overlap of two shapely.Polygon() objects, the overlap percentage and the overlap area.
:param poly1: first shapely.Polygon() object
:param poly2: second shapely.Polygon() object
...
...
@@ -46,7 +46,8 @@ def get_overlap_polygon(poly1, poly2, v=False):
def
get_footprint_polygon
(
CornerLonLat
,
fix_invalid
=
False
):
""" Converts a list of coordinates into a shapely polygon object.
""" Convert a list of coordinates into a shapely polygon object.
:param CornerLonLat: a list of coordinate tuples like [[lon,lat], [lon. lat], ..]
in clockwise or counter clockwise order
:param fix_invalid: fix invalid output polygon by returning its convex hull (somtimes this can be different)
...
...
@@ -69,7 +70,7 @@ def get_footprint_polygon(CornerLonLat, fix_invalid=False):
def
get_smallest_boxImYX_that_contains_boxMapYX
(
box_mapYX
,
gt_im
,
tolerance_ndigits
=
5
):
"""Return
s
image coordinates of the smallest box at the given coordinate grid that contains the given map coords box.
"""Return image coordinates of the smallest box at the given coordinate grid that contains the given map coords box.
:param box_mapYX: input box ccordinates as YX-tuples
:param gt_im: geotransform of input box
...
...
@@ -96,7 +97,7 @@ def get_largest_onGridPoly_within_poly(outerPoly, gt, rows, cols):
def
get_smallest_shapelyImPolyOnGrid_that_contains_shapelyImPoly
(
shapelyPoly
):
"""Return
s
the smallest box that matches the coordinate grid of the given geotransform.
"""Return the smallest box that matches the coordinate grid of the given geotransform.
The returned shapely polygon contains image coordinates."""
xmin
,
ymin
,
xmax
,
ymax
=
shapelyPoly
.
bounds
# image_coords-bounds
...
...
@@ -118,7 +119,7 @@ def find_line_intersection_point(line1, line2):
def
polyVertices_outside_poly
(
inner_poly
,
outer_poly
):
"""Check
s
if a shapely polygon (inner_poly) contains vertices that do not intersect another polygon (outer_poly)
"""Check if a shapely polygon (inner_poly) contains vertices that do not intersect another polygon (outer_poly)
:param inner_poly: the polygon with the vertices to check
:param outer_poly: the polygon where all vertices have to be inside
...
...
@@ -138,7 +139,7 @@ def polyVertices_outside_poly(inner_poly, outer_poly):
def
fill_holes_within_poly
(
poly
):
# type: (Union[Polygon, MultiPolygon]) -> Polygon
"""Fill
s
the holes within a shapely Polygon or MultiPolygon and returns a Polygon with only the outer boundary.
"""Fill the holes within a shapely Polygon or MultiPolygon and returns a Polygon with only the outer boundary.
:param poly: <shapely.geometry.Polygon, shapely.geometry.MultiPolygon>, shapely.geometry.GeometryCollection>
:return:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment