File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
class GpdHelper :
9
9
def __init__ (self ) -> None :
10
- pass
10
+ self .input_epsg = input_epsg
11
+ self .output_epsg = output_epsg
12
+
13
+
14
+ def get_bound_from_polygon (self , polygon : Polygon ) -> tuple :
15
+ """ Computes bounds value for the given polygon
16
+
17
+ Args:
18
+ polygon (Polygon): Shapely geometry object describing the polygon.
19
+
20
+ Returns:
21
+ tuple: A tuple of Bounds object and a string of a given polygon in a form accepted by the pdal pipeline.
22
+ """
23
+ polygon_df = gpd .GeoDataFrame ([polygon ], columns = ['geometry' ])
24
+ polygon_df .set_crs (epsg = self .output_epsg , inplace = True )
25
+ polygon_df ['geometry' ] = polygon_df ['geometry' ].to_crs (epsg = self .input_epsg )
26
+ xmin , ymin , xmax , ymax = polygon_df ['geometry' ][0 ].bounds
27
+ bound = Bounds (xmin , xmax , ymin , ymax )
28
+ x_cord , y_cord = polygon_df ['geometry' ][0 ].exterior .coords .xy
29
+ polygon_str = self .get_polygon_str (x_cord , y_cord )
30
+
31
+ return bound , polygon_str
32
+
33
+
34
+
You can’t perform that action at this time.
0 commit comments