示例#1
0
    def test_poly_n(self):
        g = geos.Polygon(((0,0), (2,0), (2,8), (8,8), (8,0), (10,0), (10,10), (0,10), (0,0)))

        p = PointOnSurface()
        g2 = p.handle(g)

        self.assertEqual(g2.geom_type, 'Point')
        self.assert_(g2.intersects(g))
示例#2
0
    def test_line(self):
        g = geos.LineString((0,0), (0,10), (10,10))

        p = PointOnSurface()
        g2 = p.handle(g)

        self.assertEqual(g2.geom_type, 'Point')
        self.assert_(g2.tuple in g.tuple)
示例#3
0
    def test_poly_square(self):
        g = geos.Polygon(((0,0), (10,0), (10,10), (0,10), (0,0)))

        p = PointOnSurface()
        g2 = p.handle(g)

        self.assertEqual(g2.geom_type, 'Point')
        self.assert_(g2.intersects(g))
        self.assertEqual(g2.tuple, (5,5))