You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

io.py 819 B

123456789101112131415161718192021222324
  1. """
  2. Module that holds classes for performing I/O operations on GEOS geometry
  3. objects. Specifically, this has Python implementations of WKB/WKT
  4. reader and writer classes.
  5. """
  6. from django.contrib.gis.geos.geometry import GEOSGeometry
  7. from django.contrib.gis.geos.prototypes.io import (
  8. WKBWriter, WKTWriter, _WKBReader, _WKTReader,
  9. )
  10. __all__ = ['WKBWriter', 'WKTWriter', 'WKBReader', 'WKTReader']
  11. # Public classes for (WKB|WKT)Reader, which return GEOSGeometry
  12. class WKBReader(_WKBReader):
  13. def read(self, wkb):
  14. "Returns a GEOSGeometry for the given WKB buffer."
  15. return GEOSGeometry(super(WKBReader, self).read(wkb))
  16. class WKTReader(_WKTReader):
  17. def read(self, wkt):
  18. "Returns a GEOSGeometry for the given WKT string."
  19. return GEOSGeometry(super(WKTReader, self).read(wkt))