File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ def of(self,
6363 return result .intersection (sector )
6464
6565 def part_of (self , geometry : shapely .geometry .base .BaseGeometry ):
66+ # points cannot be divided into parts
67+ if isinstance (geometry , shapely .Point | shapely .MultiPoint ):
68+ return geometry
69+ # calculate diameter and centroid
6670 d = shapely .minimum_bounding_radius (geometry ) * 2
6771 c = geometry .centroid
6872 # create point at azimuth 0 (North) and rotate (negative = clockwise)
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ def test_inner_regions(georeader: GeoJsonDirReader):
3131 assert NorthEast .part_of (india ).intersection (gorakhpur ).area > 0
3232 assert SouthWest .part_of (india ).intersection (gorakhpur ).area == 0
3333
34+ # SouthWest part of a point is the point
35+ kintbury = georeader .read (21517801 )
36+ assert SouthWest .part_of (kintbury ) == kintbury
37+
3438
3539def test_outer_regions (georeader : GeoJsonDirReader ):
3640 az = georeader .read (162018 )
You can’t perform that action at this time.
0 commit comments