GEOSGeometry('POINT EMPTY').ogr crashes
In [1]: from django.contrib.gis.geos import GEOSGeometry
In [2]: GEOSGeometry('POINT EMPTY').ogr
No handlers could be found for logger "django.contrib.gis"
---------------------------------------------------------------------------
GEOSException Traceback (most recent call last)
<ipython-input-2-2913b5e786ad> in <module>()
----> 1 GEOSGeometry('POINT EMPTY').ogr
/home/sergey/dev/django/django/contrib/gis/geos/geometry.pyc in ogr(self)
484 except gdal.SRSException:
485 pass
--> 486 return gdal.OGRGeometry(self.wkb)
487
488 @property
/home/sergey/dev/django/django/contrib/gis/geos/geometry.pyc in wkb(self)
450 `ewkb` property instead.
451 """
--> 452 return wkb_w(3 if self.hasz else 2).write(self)
453
454 @property
/home/sergey/dev/django/django/contrib/gis/geos/prototypes/io.pyc in write(self, geom)
227 def write(self, geom):
228 "Returns the WKB representation of the given geometry."
--> 229 return six.memoryview(wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t())))
230
231 def write_hex(self, geom):
/home/sergey/dev/django/django/contrib/gis/geos/libgeos.pyc in __call__(self, *args, **kwargs)
155 if self.func is None:
156 self.func = self.get_func(*self.args, **self.kwargs)
--> 157 return self.func(*args, **kwargs)
158
159 def get_func(self, *args, **kwargs):
/home/sergey/dev/django/django/contrib/gis/geos/prototypes/threadsafe.pyc in __call__(self, *args)
54 # Call the threaded GEOS routine with pointer of the context handle
55 # as the first argument.
---> 56 return self.cfunc(self.thread_context.handle.ptr, *args)
57 else:
58 return self.cfunc(*args)
/home/sergey/dev/django/django/contrib/gis/geos/prototypes/errcheck.pyc in check_sized_string(result, func, cargs)
60 """
61 if not result:
---> 62 raise GEOSException('Invalid string pointer returned by GEOS C function "%s"' % func.__name__)
63 # A c_size_t object is passed in by reference for the second
64 # argument on these routines, and its needed to determine the
GEOSException: Invalid string pointer returned by GEOS C function "GEOSWKBWriter_write_r"
The cause of this problem is that empty points couldn't be represented in WKB.
There are similar crashes in the other places. I'm not sure if individual tickets should be created or all fixes should be done within the bounds of this ticket.
Change History
(8)
Owner: |
changed from nobody to Sergey Fedoseev
|
Status: |
new → assigned
|
Triage Stage: |
Unreviewed → Accepted
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
I think however you want to provide fixes will be fine. Perhaps multiple commits referencing the same ticket would be fine.