示例#1
0
def python_test(data1, data2):
    TIME_START(func_name)
    arctern.ST_Within(arctern.ST_GeomFromText(data1),
                      arctern.ST_GeomFromText(data2))
    TIME_END(func_name)

    return TIME_INFO()
示例#2
0
def test_ST_Within():
    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,3 2)"
    p14 = "POINT(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_Within(arctern.ST_GeomFromText(data2),
                            arctern.ST_GeomFromText(data1))
    assert len(rst) == 4
    assert rst[0] == 0
    assert rst[1] == 0
    assert rst[2] == 0
    assert rst[3] == 0

    rst = arctern.ST_Within(
        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] == 0
    assert rst[2] == 1
    assert rst[3] == 0

    rst = arctern.ST_Within(
        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] == 0
    assert rst[1] == 0
    assert rst[2] == 0
    assert rst[3] == 0

    rst = arctern.ST_Within(
        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
示例#3
0
def test_ST_Within():
    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_Within(arctern.ST_GeomFromText(data2),
                            arctern.ST_GeomFromText(data1))
    assert len(rst) == 10000000
示例#4
0
def ST_Within():
    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_Within(data1, data2)
    assert len(rst) == 40000000
示例#5
0
def test_ST_Within():
    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,3 2)"
    p14 = "POINT(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_Within(data2, data1)
    assert rst[0] == 0
    assert rst[1] == 0
    assert rst[2] == 0
    assert rst[3] == 0
示例#6
0
def ST_Within(left, right):
    return arctern.ST_Within(left, right)