def test_ST_PolygonFromEnvelope2(): x_min = pandas.Series([0.0 for x in range(1, 40000001)]) x_max = pandas.Series([1.0 for x in range(1, 40000001)]) y_min = pandas.Series([2.0 for x in range(1, 40000001)]) y_max = pandas.Series([3.0 for x in range(1, 40000001)]) rst = arctern.ST_PolygonFromEnvelope(x_min, y_min, x_max, y_max) assert len(rst) == 40000000
def test_ST_PolygonFromEnvelope(): x_min = pandas.Series([0.0 for x in range(1, 10000001)]) x_max = pandas.Series([1.0 for x in range(1, 10000001)]) y_min = pandas.Series([0.0 for x in range(1, 10000001)]) y_max = pandas.Series([1.0 for x in range(1, 10000001)]) rst = arctern.ST_AsText( arctern.ST_PolygonFromEnvelope(x_min, y_min, x_max, y_max)) assert len(rst) == 10000000
def test_ST_PolygonFromEnvelope(): x_min = pandas.Series([0.0]) x_max = pandas.Series([1.0]) y_min = pandas.Series([0.0]) y_max = pandas.Series([1.0]) rst = arctern.ST_PolygonFromEnvelope(x_min, y_min, x_max, y_max) assert rst[0] == "POLYGON ((0 0,0 1,1 1,1 0,0 0))"
def polygon_from_envelope(cls, min_x, min_y, max_x, max_y, crs=None): """ Construct polygon(rectangle) geometries from arr_min_x, arr_min_y, arr_max_x, arr_max_y and special coordinate system. The edges of polygon are parallel to coordinate axis. :type min_x: Series(dtype: float64) :param min_x: The minimum value of x coordinate of the rectangles. :type min_y: Series(dtype: float64) :param min_y: The minimum value of y coordinate of the rectangles. :type max_x: Series(dtype: float64) :param max_x: The maximum value of x coordinate of the rectangles. :type max_y: Series(dtype: float64) :param max_y: The maximum value of y coordinate of the rectangles. :type crs: string, optional :param crs: Must be SRID format string. :rtype: GeoSeries :return: A GeoSeries contains geometries. :example: >>> from pandas import Series >>> from arctern import GeoSeries >>> min_x = Series([0.0, 1.0]) >>> max_x = Series([2.0, 1.5]) >>> min_y = Series([0.0, 1.0]) >>> max_y = Series([1.0, 1.5]) >>> GeoSeries.polygon_from_envelope(min_x, min_y, max_x, max_y) 0 POLYGON ((0 0,0 1,2 1,2 0,0 0)) 1 POLYGON ((1 1,1.0 1.5,1.5 1.5,1.5 1.0,1 1)) dtype: GeoDtype """ crs = _validate_crs(crs) return cls(arctern.ST_PolygonFromEnvelope(min_x, min_y, max_x, max_y), crs=crs)
def ST_PolygonFromEnvelope(min_x, min_y, max_x, max_y): return arctern.ST_PolygonFromEnvelope(min_x, min_y, max_x, max_y)
def python_test(x_min, y_min, x_max, y_max): TIME_START(func_name) arctern.ST_AsText(arctern.ST_PolygonFromEnvelope(x_min, y_min, x_max, y_max)) TIME_END(func_name) return TIME_INFO()