Coverage for pyguymer3/geo/__init__.py: 100%

56 statements  

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

1#!/usr/bin/env python3 

2 

3""" 

4A Python sub-module containing a bunch of random geo-related functions that I 

5have written over the years. 

6 

7Notes 

8----- 

9See the following two sources of documentation from GIS software to read a bit 

10more about buffering: 

11 

12* `ArcGIS buffering <https://desktop.arcgis.com/en/arcmap/latest/tools/analysis-toolbox/buffer.htm>`_ 

13* `QGIS buffering <https://qgis.org/pyqgis/3.22/core/QgsGeometry.html#qgis.core.QgsGeometry.buffer>`_ 

14 

15To clarify some the geometry data types: 

16 

17* A ``shapely.geometry.point.Point`` is made up of a 

18 ``shapely.coords.CoordinateSequence`` of 1 ``tuple`` of a (lon,lat) pair. 

19* A ``shapely.geometry.polygon.LinearRing`` is made up of a 

20 ``shapely.coords.CoordinateSequence`` of N ``tuple`` of (lon,lat) pairs. 

21* A ``shapely.geometry.linestring.LineString`` is made up of a 

22 ``shapely.coords.CoordinateSequence`` of N ``tuple`` of (lon,lat) pairs. 

23* A ``shapely.geometry.polygon.Polygon`` is made up of a 

24 ``shapely.geometry.polygon.LinearRing`` exterior (and *maybe* N 

25 ``shapely.geometry.polygon.LinearRing`` interiors). 

26* A ``shapely.geometry.multipoint.MultiPoint`` is made up of N 

27 ``shapely.geometry.point.Point``. 

28* A ``shapely.geometry.multilinestring.MultiLineString`` is made up of N 

29 ``shapely.geometry.linestring.LineString``. 

30* A ``shapely.geometry.multipolygon.MultiPolygon`` is made up of N 

31 ``shapely.geometry.polygon.Polygon``. 

32 

33The basic call graphs for :func:`pyguymer3.geo.buffer` and 

34:func:`pyguymer3.geo.fillin` are: 

35 

36* :func:`pyguymer3.geo.buffer` calls: 

37 

38 * :func:`pyguymer3.geo.bufferSrc.buffer_CoordinateSequence` (this is the 

39 only function that actually does any buffering, as evidenced by it not 

40 calling any other ``bufferSrc`` functions) 

41 

42 * :func:`pyguymer3.geo._buffer_points_crudely` 

43 * :func:`pyguymer3.geo._points2polys` 

44 * :func:`pyguymer3.geo.fillin` 

45 

46 * :func:`pyguymer3.geo.bufferSrc.buffer_LinearRing` calls: 

47 

48 * :func:`pyguymer3.geo.bufferSrc.buffer_CoordinateSequence` 

49 

50 * :func:`pyguymer3.geo.bufferSrc.buffer_LineString` calls: 

51 

52 * :func:`pyguymer3.geo.bufferSrc.buffer_CoordinateSequence` 

53 

54 * :func:`pyguymer3.geo.bufferSrc.buffer_MultiLineString` calls: 

55 

56 * :func:`pyguymer3.geo.bufferSrc.buffer_LineString` 

57 

58 * :func:`pyguymer3.geo.bufferSrc.buffer_MultiPoint` calls: 

59 

60 * :func:`pyguymer3.geo.bufferSrc.buffer_Point` 

61 

62 * :func:`pyguymer3.geo.bufferSrc.buffer_MultiPolygon` calls: 

63 

64 * :func:`pyguymer3.geo.bufferSrc.buffer_Polygon` 

65 

66 * :func:`pyguymer3.geo.bufferSrc.buffer_Point` calls: 

67 

68 * :func:`pyguymer3.geo.bufferSrc.buffer_CoordinateSequence` 

69 

70 * :func:`pyguymer3.geo.bufferSrc.buffer_Polygon` calls: 

71 

72 * :func:`pyguymer3.geo.bufferSrc.buffer_LinearRing` 

73 

74* :func:`pyguymer3.geo.fillin` 

75 

76 * :func:`pyguymer3.geo.fillinSrc.fillin_CoordinateSequence` (this is the 

77 only function that actually does any filling in, as evidenced by it not 

78 calling any other ``fillinSrc`` functions) 

79 

80 * :func:`pyguymer3.geo.calc_dist_between_two_locs` 

81 * :func:`pyguymer3.geo.great_circle` 

82 

83 * :func:`pyguymer3.geo.fillinSrc.fillin_LinearRing` calls: 

84 

85 * :func:`pyguymer3.geo.fillinSrc.fillin_CoordinateSequence` 

86 

87 * :func:`pyguymer3.geo.fillinSrc.fillin_LineString` calls: 

88 

89 * :func:`pyguymer3.geo.fillinSrc.fillin_CoordinateSequence` 

90 

91 * :func:`pyguymer3.geo.fillinSrc.fillin_MultiLineString` calls: 

92 

93 * :func:`pyguymer3.geo.fillinSrc.fillin_LineString` 

94 

95 * :func:`pyguymer3.geo.fillinSrc.fillin_MultiPolygon` calls: 

96 

97 * :func:`pyguymer3.geo.fillinSrc.fillin_Polygon` 

98 

99 * :func:`pyguymer3.geo.fillinSrc.fillin_Polygon` calls: 

100 

101 * :func:`pyguymer3.geo.fillinSrc.fillin_LinearRing` 

102 

103Copyright 2017 Thomas Guymer [1]_ 

104 

105References 

106---------- 

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

108""" 

109 

110# Import sub-functions ... 

111from ._add_antarcticIceShelves import _add_antarcticIceShelves 

112from ._add_background import _add_background 

113from ._add_bathymetry import _add_bathymetry 

114from ._add_coastlines import _add_coastlines 

115from ._add_elevation import _add_elevation 

116from ._add_glaciatedAreas import _add_glaciatedAreas 

117from ._add_global_axis import _add_global_axis 

118from ._add_horizontal_gridlines import _add_horizontal_gridlines 

119from ._add_lakes import _add_lakes 

120from ._add_land import _add_land 

121from ._add_minorIslands import _add_minorIslands 

122from ._add_playas import _add_playas 

123from ._add_railroads import _add_railroads 

124from ._add_reefs import _add_reefs 

125from ._add_rivers import _add_rivers 

126from ._add_roads import _add_roads 

127from ._add_topDown_axis import _add_topDown_axis 

128from ._add_urbanAreas import _add_urbanAreas 

129from ._add_vertical_gridlines import _add_vertical_gridlines 

130from ._area import _area 

131from ._buffer_points_crudely import _buffer_points_crudely 

132from ._debug import _debug 

133from ._points2polys import _points2polys 

134from .add_annotation import add_annotation 

135from .add_axis import add_axis 

136from .add_GSHHG_map_underlay import add_GSHHG_map_underlay 

137from .add_map_background import add_map_background 

138from .add_NE_map_underlay import add_NE_map_underlay 

139from .add_OSM_map_background import add_OSM_map_background 

140from .area import area 

141from .buffer import buffer 

142from .calc_angle_between_two_locs import calc_angle_between_two_locs 

143from .calc_dist_between_two_locs import calc_dist_between_two_locs 

144from .calc_loc_from_loc_and_bearing_and_dist import calc_loc_from_loc_and_bearing_and_dist 

145from .check import check 

146from .clean import clean 

147from .clipLatitude import clipLatitude 

148from .create_image_of_points import create_image_of_points 

149from .create_map_of_points import create_map_of_points 

150from .en2ll import en2ll 

151from .extract_lines import extract_lines 

152from .extract_points import extract_points 

153from .extract_polys import extract_polys 

154from .fillin import fillin 

155from .find_middle_of_great_circle import find_middle_of_great_circle 

156from .find_middle_of_locs import find_middle_of_locs 

157from .find_min_max_dist_bearing import find_min_max_dist_bearing 

158from .find_point_on_great_circle import find_point_on_great_circle 

159from .getRecordAttribute import getRecordAttribute 

160from .great_circle import great_circle 

161from .ll2en import ll2en 

162from .ll2mer import ll2mer 

163from .max_dist import max_dist 

164from .mer2ll import mer2ll 

165from .min_dist import min_dist 

166from .wrapLongitude import wrapLongitude