Exemplo n.º 1
0
def test_ST_Distance():
    p11 = "LINESTRING(9 0,9 2)"
    p12 = "POINT(10 2)"
    data1 = pandas.Series([p11, p12])

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

    rst = arctern.ST_Distance(arctern.ST_GeomFromText(data2),
                              arctern.ST_GeomFromText(data1))
    assert len(rst) == 2
    assert rst[0] == 1.0
    assert rst[1] == 2.0

    rst = arctern.ST_Distance(
        arctern.ST_GeomFromText("POLYGON((0 0,0 8,8 8,8 0,0 0))")[0],
        arctern.ST_GeomFromText(data1))
    assert len(rst) == 2
    assert rst[0] == 1.0
    assert rst[1] == 2.0

    rst = arctern.ST_Distance(
        arctern.ST_GeomFromText(data1),
        arctern.ST_GeomFromText("POLYGON((0 0,0 8,8 8,8 0,0 0))")[0])
    assert len(rst) == 2
    assert rst[0] == 1.0
    assert rst[1] == 2.0

    rst = arctern.ST_Distance(
        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] == 0.0
Exemplo n.º 2
0
def test_ST_Distance():
    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_Distance(arctern.ST_GeomFromText(data2),
                              arctern.ST_GeomFromText(data1))
    assert len(rst) == 10000000
Exemplo n.º 3
0
def ST_Distance():
    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_Distance(data1, data2)
    assert len(rst) == 40000000
Exemplo n.º 4
0
def test_ST_Distance():
    p11 = "LINESTRING(9 0,9 2)"
    p12 = "POINT(10 2)"
    data1 = pandas.Series([p11, p12])

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

    rst = arctern.ST_Distance(data2, data1)

    assert rst[0] == 1.0
    assert rst[1] == 2.0
Exemplo n.º 5
0
def ST_Distance(left, right):
    return arctern.ST_Distance(left, right)
Exemplo n.º 6
0
def python_test(data1, data2):
    TIME_START(func_name)
    arctern.ST_Distance(arctern.ST_GeomFromText(data1), arctern.ST_GeomFromText(data2))
    TIME_END(func_name)
    return TIME_INFO()