Skip to content

Commit

Permalink
Add _concatenator method to GeometryBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Oct 14, 2017
1 parent d5ef041 commit bc68baa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions geopandas/_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion geopandas/vectorized.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit bc68baa

Please sign in to comment.