def test_ST_DistanceSphere(): import math p11 = "POINT(-73.981153 40.741841)" p12 = "POINT(200 10)" data1 = pandas.Series([p11, p12]) p21 = "POINT(-73.99016751859183 40.729884354626904)" p22 = "POINT(10 2)" data2 = pandas.Series([p21, p22]) rst = arctern.ST_DistanceSphere(arctern.ST_GeomFromText(data2), arctern.ST_GeomFromText(data1)) assert len(rst) == 2 assert abs(rst[0] - 1531) < 1 assert math.isnan(rst[1]) data = pandas.Series(["POINT(0 0)"]) rst = arctern.ST_DistanceSphere(arctern.ST_GeomFromText(data), arctern.ST_GeomFromText("POINT(0 0)")[0]) assert len(rst) == 1 assert math.isclose(rst[0], 0.0, rel_tol=1e-5) data = pandas.Series(["POINT(0 0)"]) rst = arctern.ST_DistanceSphere( arctern.ST_GeomFromText("POINT(0 0)")[0], arctern.ST_GeomFromText(data)) assert len(rst) == 1 assert math.isclose(rst[0], 0.0, rel_tol=1e-5) data = pandas.Series(["POINT(0 0)"]) rst = arctern.ST_DistanceSphere( arctern.ST_GeomFromText("POINT(0 0)")[0], arctern.ST_GeomFromText("POINT(0 0)")[0]) assert len(rst) == 1 assert math.isclose(rst[0], 0.0, rel_tol=1e-5)
def test_ST_DistanceSphere(): 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_DistanceSphere(arctern.ST_GeomFromText(data2), arctern.ST_GeomFromText(data1)) assert len(rst) == 10000000
def ST_DistanceSphere(): 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_DistanceSphere(data1, data2) assert len(rst) == 40000000
def test_ST_DistanceSphere(): import math p11 = "POINT(-73.981153 40.741841)" p12 = "POINT(200 10)" data1 = pandas.Series([p11, p12]) p21 = "POINT(-73.99016751859183 40.729884354626904)" p22 = "POINT(10 2)" data2 = pandas.Series([p21, p22]) rst = arctern.ST_DistanceSphere(arctern.ST_GeomFromText(data2), arctern.ST_GeomFromText(data1)) assert abs(rst[0] - 1531) < 1 assert math.isnan(rst[1])
def python_test(data1, data2): TIME_START(func_name) arctern.ST_DistanceSphere(arctern.ST_GeomFromText(data1), arctern.ST_GeomFromText(data2)) TIME_END(func_name) return TIME_INFO()