コード例 #1
0
def test_ST_Union_Aggr():
    p1 = "POLYGON ((1 1,1 2,2 2,2 1,1 1))"
    p2 = "POLYGON ((2 1,3 1,3 2,2 2,2 1))"
    data = pandas.Series([p1, p2])
    rst = arctern.ST_AsText(
        arctern.ST_Union_Aggr(arctern.ST_GeomFromText(data)))
    assert rst[0] == "POLYGON ((1 1,1 2,2 2,3 2,3 1,2 1,1 1))"

    p1 = "POLYGON ((0 0,4 0,4 4,0 4,0 0))"
    p2 = "POLYGON ((3 1,5 1,5 2,3 2,3 1))"
    data = pandas.Series([p1, p2])
    rst = arctern.ST_AsText(
        arctern.ST_Union_Aggr(arctern.ST_GeomFromText(data)))
    assert rst[0] == "POLYGON ((4 1,4 0,0 0,0 4,4 4,4 2,5 2,5 1,4 1))"

    p1 = "POLYGON ((0 0,4 0,4 4,0 4,0 0))"
    p2 = "POLYGON ((5 1,7 1,7 2,5 2,5 1))"
    data = pandas.Series([p1, p2])
    rst = arctern.ST_AsText(
        arctern.ST_Union_Aggr(arctern.ST_GeomFromText(data)))
    assert rst[
        0] == "MULTIPOLYGON (((0 0,4 0,4 4,0 4,0 0)),((5 1,7 1,7 2,5 2,5 1)))"

    p1 = "POLYGON ((0 0,0 4,4 4,4 0,0 0))"
    p2 = "POINT (2 3)"

    data = pandas.Series([p1, p2])
    rst = arctern.ST_AsText(
        arctern.ST_Union_Aggr(arctern.ST_GeomFromText(data)))
    assert rst[0] == p1
コード例 #2
0
def test_ST_Union_Aggr():
    geo = "POLYGON ((0 0,0 1,1 1,1 0,0 0))"
    arr = [geo for x in range(1, 10000001)]
    data = pandas.Series(arr)
    rst = arctern.ST_AsText(
        arctern.ST_Union_Aggr(arctern.ST_GeomFromText(data)))
    assert len(rst) == 1
コード例 #3
0
    def union_aggr(self):
        """
        Return a geometry that represents the union of all geometries in the GeoSeries.

        :rtype: GeoSeries
        :return: A GeoSeries contains only one geometry.

        :example:
        >>> from arctern import GeoSeries
        >>> p1 = "POINT(1 2)"
        >>> p2 = "POINT(1 1)"
        >>> s = GeoSeries([p1, p2])
        >>> s.union_aggr()
        0    MULTIPOINT (1 2,1 1)
        dtype: GeoDtype
        """
        return GeoSeries(arctern.ST_Union_Aggr(self))
コード例 #4
0
ファイル: _wrapper_func.py プロジェクト: xiaolingis/arctern
def ST_Union_Aggr(geos):
    return arctern.ST_Union_Aggr(geos)
コード例 #5
0
def python_test(data):
    TIME_START(func_name)
    arctern.ST_AsText(arctern.ST_Union_Aggr(arctern.ST_GeomFromText(data)))
    TIME_END(func_name)

    return TIME_INFO()
コード例 #6
0
 def agg(s):
     return arctern.ST_Union_Aggr(s)[0]