Ejemplo n.º 1
0
def python_test(data1, data2):
    TIME_START(func_name)
    arctern.ST_Intersects(arctern.ST_GeomFromText(data1),
                          arctern.ST_GeomFromText(data2))
    TIME_END(func_name)

    return TIME_INFO()
Ejemplo n.º 2
0
def test_ST_Intersects():
    p11 = "POLYGON((0 0,1 0,1 1,0 1,0 0))"
    p12 = "POLYGON((8 0,9 0,9 1,8 1,8 0))"
    p13 = "LINESTRING(2 2,10 2)"
    p14 = "LINESTRING(9 2,10 2)"
    data1 = pandas.Series([p11, p12, p13, p14])

    p21 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    p22 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    p23 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    p24 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    data2 = pandas.Series([p21, p22, p23, p24])

    rst = arctern.ST_Intersects(arctern.ST_GeomFromText(data2),
                                arctern.ST_GeomFromText(data1))
    assert rst[0] == 1
    assert rst[1] == 1
    assert rst[2] == 1
    assert rst[3] == 0

    rst = arctern.ST_Intersects(
        arctern.ST_GeomFromText(data1),
        arctern.ST_GeomFromText("POLYGON((0 0,0 8,8 8,8 0,0 0))")[0])
    assert len(rst) == 4
    assert rst[0] == 1
    assert rst[1] == 1
    assert rst[2] == 1
    assert rst[3] == 0

    rst = arctern.ST_Intersects(
        arctern.ST_GeomFromText("POLYGON((0 0,0 8,8 8,8 0,0 0))")[0],
        arctern.ST_GeomFromText(data1))
    assert len(rst) == 4
    assert rst[0] == 1
    assert rst[1] == 1
    assert rst[2] == 1
    assert rst[3] == 0

    rst = arctern.ST_Contains(
        arctern.ST_GeomFromText("POLYGON((0 0,0 8,8 8,8 0,0 0))")[0],
        arctern.ST_GeomFromText("POLYGON((0 0,0 8,8 8,8 0,0 0))")[0])
    assert len(rst) == 1
    assert rst[0] == 1
Ejemplo n.º 3
0
def test_ST_Intersects():
    geo1 = "POLYGON ((0 0,0 1,1 1,1 0,0 0))"
    geo2 = "POLYGON ((0 0,0 2,2 2,2 0,0 0))"
    arr1 = [geo1 for x in range(1, 10000001)]
    arr2 = [geo2 for x in range(1, 10000001)]

    data1 = pandas.Series(arr1)
    data2 = pandas.Series(arr2)
    rst = arctern.ST_AsText(
        arctern.ST_Intersects(arctern.ST_GeomFromText(data1),
                              arctern.ST_GeomFromText(data2)))
    assert len(rst) == 10000000
Ejemplo n.º 4
0
def ST_Intersects():
    geo1 = "POLYGON ((113.66220266388723 22.39277623851494, 114.58136061218778 22.39277623851494, 114.58136061218778 22.92800492531275 ,113.66220266388723 22.92800492531275, 113.66220266388723 22.39277623851494))"
    geo2 = "POINT (1 1)"
    geo_wkb1 = arctern.ST_GeomFromText(geo1)[0]
    geo_wkb2 = arctern.ST_GeomFromText(geo2)[0]
    arr1 = [geo_wkb1 for x in range(1, 40000001)]
    arr2 = [geo_wkb2 for x in range(1, 40000001)]

    data1 = pandas.Series(arr1)
    data2 = pandas.Series(arr2)
    rst = arctern.ST_Intersects(data1, data2)
    assert len(rst) == 40000000
Ejemplo n.º 5
0
def test_ST_Intersects():
    p11 = "POLYGON((0 0,1 0,1 1,0 1,0 0))"
    p12 = "POLYGON((8 0,9 0,9 1,8 1,8 0))"
    p13 = "LINESTRING(2 2,10 2)"
    p14 = "LINESTRING(9 2,10 2)"
    data1 = pandas.Series([p11, p12, p13, p14])

    p21 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    p22 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    p23 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    p24 = "POLYGON((0 0,0 8,8 8,8 0,0 0))"
    data2 = pandas.Series([p21, p22, p23, p24])

    rst = arctern.ST_Intersects(data2, data1)
    assert rst[0] == 1
    assert rst[1] == 1
    assert rst[2] == 1
    assert rst[3] == 0
Ejemplo n.º 6
0
def ST_Intersects(left, right):
    return arctern.ST_Intersects(left, right)