django.contrib.gis.geos.WKTReader - python examples

Here are the examples of the python api django.contrib.gis.geos.WKTReader taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : test_io.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test01_wktreader(self):
        # Creating a WKTReader instance
        wkt_r = WKTReader()
        wkt = 'POINT (5 23)'

        # read() should return a GEOSGeometry
        ref = GEOSGeometry(wkt)
        g1 = wkt_r.read(wkt.encode())
        g2 = wkt_r.read(wkt)

        for geom in (g1, g2):
            self.astertEqual(ref, geom)

        # Should only accept string objects.
        with self.astertRaises(TypeError):
            wkt_r.read(1)
        with self.astertRaises(TypeError):
            wkt_r.read(memoryview(b'foo'))