From bc68baa20ec7b3931f023064cbe2a01a6eb98411 Mon Sep 17 00:00:00 2001 From: Matthew Rocklin Date: Sat, 14 Oct 2017 08:52:18 -0400 Subject: [PATCH] Add _concatenator method to GeometryBlock Following on https://github.com/pandas-dev/pandas/pull/17728 --- geopandas/_block.py | 7 ++++--- geopandas/vectorized.pyx | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/geopandas/_block.py b/geopandas/_block.py index 4055f80a7a..178938ed62 100644 --- a/geopandas/_block.py +++ b/geopandas/_block.py @@ -6,14 +6,15 @@ from pandas.core.common import is_null_slice from shapely.geometry.base import geom_factory, BaseGeometry -from .vectorized import GeometryArray, to_shapely +from .vectorized import GeometryArray, to_shapely, concat class GeometryBlock(NonConsolidatableMixIn, Block): - """ implement a geometry block with uint pointers to C objects - as underlying data""" + """ Pandas Geometry block with pointers to C GEOS objects """ __slots__ = () + _concatenator = concat + @property def _holder(self): return GeometryArray diff --git a/geopandas/vectorized.pyx b/geopandas/vectorized.pyx index 29bf628e01..332716e4d9 100644 --- a/geopandas/vectorized.pyx +++ b/geopandas/vectorized.pyx @@ -1566,7 +1566,9 @@ cpdef cysjoin(np.ndarray[np.uintp_t, ndim=1, cast=True] left, return left_out, right_out -def concat(L): +def concat(L, axis=0): + if axis != 0: + raise NotImplementedError("Can only concatenate geometries along axis=0") L = list(L) x = np.concatenate([ga.data for ga in L]) return GeometryArray(x, base=set(L))