Esempio n. 1
0
def test_ST_Intersection():
    data1 = pandas.Series(["POLYGON ((1 1,1 2,2 2,2 1,1 1))", "POINT (0 1)"])
    data2 = pandas.Series(["POLYGON ((2 1,3 1,3 2,2 2,2 1))", "POINT (0 1)"])
    rst = arctern.ST_AsText(
        arctern.ST_Intersection(arctern.ST_GeomFromText(data1),
                                arctern.ST_GeomFromText(data2)))
    assert len(rst) == 2
    assert rst[0] == "LINESTRING (2 2,2 1)"
    assert rst[1] == "POINT (0 1)"

    rst = arctern.ST_AsText(
        arctern.ST_Intersection(arctern.ST_GeomFromText(data1),
                                arctern.ST_GeomFromText("POINT (0 1)")[0]))
    assert len(rst) == 2
    assert rst[0] == "GEOMETRYCOLLECTION EMPTY"
    assert rst[1] == "POINT (0 1)"

    rst = arctern.ST_AsText(
        arctern.ST_Intersection(
            arctern.ST_GeomFromText("POINT (0 1)")[0],
            arctern.ST_GeomFromText(data1)))
    assert len(rst) == 2
    assert rst[0] == "GEOMETRYCOLLECTION EMPTY"
    assert rst[1] == "POINT (0 1)"

    rst = arctern.ST_AsText(
        arctern.ST_Intersection(
            arctern.ST_GeomFromText("POINT (0 1)")[0],
            arctern.ST_GeomFromText("POINT (0 1)")[0]))
    assert len(rst) == 1
    assert rst[0] == "POINT (0 1)"
Esempio n. 2
0
def test_ST_Intersection():
    data1 = pandas.Series(["POLYGON ((1 1,1 2,2 2,2 1,1 1))"])
    data2 = pandas.Series(["POLYGON ((2 1,3 1,3 2,2 2,2 1))"])
    rst = arctern.ST_AsText(
        arctern.ST_Intersection(arctern.ST_GeomFromText(data1),
                                arctern.ST_GeomFromText(data2)))
    assert rst[0] == "LINESTRING (2 2,2 1)"
Esempio n. 3
0
def test_ST_Intersection():
    data1 = pandas.Series(["POLYGON ((1 1,1 2,2 2,2 1,1 1))"])
    data2 = pandas.Series(["POLYGON ((2 1,3 1,3 2,2 2,2 1))"])
    array1 = pyarrow.array(data1)
    array2 = pyarrow.array(data2)
    rst = arctern.ST_Intersection(array1, array2)
    assert rst[0] == "LINESTRING (2 2,2 1)"
Esempio n. 4
0
def python_test(data1, data2):
    TIME_START(func_name)
    arctern.ST_AsText(
        arctern.ST_Intersection(arctern.ST_GeomFromText(data1),
                                arctern.ST_GeomFromText(data2)))
    TIME_END(func_name)

    return TIME_INFO()
Esempio n. 5
0
def ST_Intersection():
    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_Intersection(data1, data2)
    assert len(rst) == 40000000
Esempio n. 6
0
def ST_Intersection(left, right):
    return arctern.ST_Intersection(left, right)
Esempio n. 7
0
def test_ST_Intersection():
    data1 = pandas.Series(["POLYGON ((1 1,1 2,2 2,2 1,1 1))"])
    data2 = pandas.Series(["POLYGON ((2 1,3 1,3 2,2 2,2 1))"])
    rst = arctern.ST_Intersection(data1, data2)
    assert rst[0] == "LINESTRING (2 2,2 1)"