web/lib/django/contrib/gis/geos/io.py
author ymh <ymh.work@gmail.com>
Wed, 02 Jun 2010 18:57:35 +0200
changeset 38 77b6da96e6f1
permissions -rw-r--r--
update django
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
"""
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
Module that holds classes for performing I/O operations on GEOS geometry
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
objects.  Specifically, this has Python implementations of WKB/WKT
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
reader and writer classes.
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
"""
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
from django.contrib.gis.geos.geometry import GEOSGeometry
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter, WKTWriter
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
# Public classes for (WKB|WKT)Reader, which return GEOSGeometry
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
class WKBReader(_WKBReader):
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    def read(self, wkb):
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
        "Returns a GEOSGeometry for the given WKB buffer."
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
        return GEOSGeometry(super(WKBReader, self).read(wkb))
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
class WKTReader(_WKTReader):
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    def read(self, wkt):
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
        "Returns a GEOSGeometry for the given WKT string."
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
        return GEOSGeometry(super(WKTReader, self).read(wkt))
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20