| 1 | In [1]: import app1.example
|
|---|
| 2 |
|
|---|
| 3 | In [2]: app1.example.fix_polygon()
|
|---|
| 4 | version = 2.2.9
|
|---|
| 5 | GEOS_NOTICE: Hole lies outside shell at or near point 1000 1000
|
|---|
| 6 |
|
|---|
| 7 | p1.valid = False
|
|---|
| 8 | p1.valid_reason = Hole lies outside shell[1000 1000]
|
|---|
| 9 | mp.geom_type = MultiPolygon
|
|---|
| 10 | mp.__class__ = <class 'django.contrib.gis.geos.polygon.Polygon'>
|
|---|
| 11 | GEOS_ERROR: Argument is not a Polygon
|
|---|
| 12 |
|
|---|
| 13 | ---------------------------------------------------------------------------
|
|---|
| 14 | GEOSException Traceback (most recent call last)
|
|---|
| 15 | <ipython-input-2-82786a0572bd> in <module>
|
|---|
| 16 | ----> 1 app1.example.fix_polygon()
|
|---|
| 17 |
|
|---|
| 18 | ~/work/holebug/h1/app1/example.py in fix_polygon()
|
|---|
| 19 | 15 print('mp.geom_type = {}'.format(mp.geom_type)) # MultiPolygon
|
|---|
| 20 | 16 print('mp.__class__ = {}'.format(mp.__class__)) # returns Polygon in 2.2 MultiPolygon in 1.11
|
|---|
| 21 | ---> 17 print(len(mp)) # GESOEXception
|
|---|
| 22 | 18
|
|---|
| 23 | 19
|
|---|
| 24 |
|
|---|
| 25 | ~/.virtualenvs/hole111/lib/python3.6/site-packages/django/contrib/gis/geos/polygon.py in __len__(self)
|
|---|
| 26 | 54 def __len__(self):
|
|---|
| 27 | 55 "Return the number of rings in this Polygon."
|
|---|
| 28 | ---> 56 return self.num_interior_rings + 1
|
|---|
| 29 | 57
|
|---|
| 30 | 58 @classmethod
|
|---|
| 31 |
|
|---|
| 32 | ~/.virtualenvs/hole111/lib/python3.6/site-packages/django/contrib/gis/geos/polygon.py in num_interior_rings(self)
|
|---|
| 33 | 149 "Return the number of interior rings."
|
|---|
| 34 | 150 # Getting the number of rings
|
|---|
| 35 | --> 151 return capi.get_nrings(self.ptr)
|
|---|
| 36 | 152
|
|---|
| 37 | 153 def _get_ext_ring(self):
|
|---|
| 38 |
|
|---|
| 39 | ~/.virtualenvs/hole111/lib/python3.6/site-packages/django/contrib/gis/geos/libgeos.py in __call__(self, *args, **kwargs)
|
|---|
| 40 | 153
|
|---|
| 41 | 154 def __call__(self, *args, **kwargs):
|
|---|
| 42 | --> 155 return self.func(*args, **kwargs)
|
|---|
| 43 | 156
|
|---|
| 44 | 157 @cached_property
|
|---|
| 45 |
|
|---|
| 46 | ~/.virtualenvs/hole111/lib/python3.6/site-packages/django/contrib/gis/geos/prototypes/threadsafe.py in __call__(self, *args)
|
|---|
| 47 | 45 # Call the threaded GEOS routine with the pointer of the context handle
|
|---|
| 48 | 46 # as the first argument.
|
|---|
| 49 | ---> 47 return self.cfunc(self.thread_context.handle.ptr, *args)
|
|---|
| 50 | 48
|
|---|
| 51 | 49 def __str__(self):
|
|---|
| 52 |
|
|---|
| 53 | ~/.virtualenvs/hole111/lib/python3.6/site-packages/django/contrib/gis/geos/prototypes/errcheck.py in check_minus_one(result, func, cargs)
|
|---|
| 54 | 37 "Error checking on routines that should not return -1."
|
|---|
| 55 | 38 if result == -1:
|
|---|
| 56 | ---> 39 raise GEOSException('Error encountered in GEOS C function "%s".' % func.__name__)
|
|---|
| 57 | 40 else:
|
|---|
| 58 | 41 return result
|
|---|
| 59 |
|
|---|
| 60 | GEOSException: Error encountered in GEOS C function "GEOSGetNumInteriorRings_r".
|
|---|