Coverage for pyguymer3/geo/fillinSrc/fillin_LinearRing.py: 75%

12 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2025-07-08 18:47 +0000

1#!/usr/bin/env python3 

2 

3# Define function ... 

4def fillin_LinearRing( 

5 ring, 

6 fill, 

7 /, 

8 *, 

9 debug = __debug__, 

10 eps = 1.0e-12, 

11 fillSpace = "EuclideanSpace", 

12 nIter = 100, 

13 prefix = ".", 

14 ramLimit = 1073741824, 

15): 

16 """Fill in a LinearRing 

17 

18 This function reads in a LinearRing that exists on the surface of the Earth 

19 and returns a LineString of the same LinearRing filled in by a constant 

20 distance: either in degrees in Euclidean space; or in metres in Geodesic 

21 space. 

22 

23 Parameters 

24 ---------- 

25 ring : shapely.geometry.polygon.LinearRing 

26 the LinearRing 

27 fill : float 

28 the Euclidean or Geodesic distance to fill in between each point within 

29 the shape by (in degrees or metres) 

30 debug : bool, optional 

31 print debug messages 

32 eps : float, optional 

33 the tolerance of the Vincenty formula iterations 

34 fillSpace : str, optional 

35 the geometric space to perform the filling in (either "EuclideanSpace" 

36 or "GeodesicSpace") 

37 nIter : int, optional 

38 the maximum number of iterations (particularly the Vincenty formula) 

39 prefix : str, optional 

40 change the name of the output debugging CSVs 

41 ramLimit : int, optional 

42 the maximum RAM usage of each "large" array (in bytes) 

43 

44 Returns 

45 ------- 

46 fills : shapely.geometry.linestring.LineString 

47 the filled in LinearRing 

48 

49 Notes 

50 ----- 

51 Copyright 2017 Thomas Guymer [1]_ 

52 

53 References 

54 ---------- 

55 .. [1] PyGuymer3, https://github.com/Guymer/PyGuymer3 

56 """ 

57 

58 # Import special modules ... 

59 try: 

60 import shapely 

61 import shapely.geometry 

62 except: 

63 raise Exception("\"shapely\" is not installed; run \"pip install --user Shapely\"") from None 

64 

65 # Import sub-functions ... 

66 from ..check import check 

67 from .fillin_CoordinateSequence import fillin_CoordinateSequence 

68 

69 # ************************************************************************** 

70 

71 # Check argument ... 

72 assert isinstance(ring, shapely.geometry.polygon.LinearRing), "\"ring\" is not a LinearRing" 

73 if debug: 

74 check(ring, prefix = prefix) 

75 

76 # Return filled in LinearRing ... 

77 return fillin_CoordinateSequence( 

78 ring.coords, 

79 fill, 

80 debug = debug, 

81 eps = eps, 

82 fillSpace = fillSpace, 

83 nIter = nIter, 

84 prefix = prefix, 

85 ramLimit = ramLimit, 

86 )