Skip to content

Commit

Permalink
Allow using geopandas interface without using geometry column (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Mar 12, 2021
1 parent 7a3a4da commit 9c32fbe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions geoviews/data/geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def init(cls, eltype, data, kdims, vdims):
def validate(cls, dataset, vdims=True):
dim_types = 'key' if vdims else 'all'
geom_dims = cls.geom_dims(dataset)
if len(geom_dims) != 2:
if len(geom_dims) > 0 and len(geom_dims) != 2:
raise DataError('Expected %s instance to declare two key '
'dimensions corresponding to the geometry '
'coordinates but %d dimensions were found '
Expand Down Expand Up @@ -247,13 +247,13 @@ def geom_dims(cls, dataset):

@classmethod
def dimension_type(cls, dataset, dim):
col = cls.geo_column(dataset.data)
if len(dataset.data):
arr = geom_to_array(dataset.data[col].iloc[0])
geom_dims = cls.geom_dims(dataset)
if dim in geom_dims:
return float
elif len(dataset.data):
return type(dataset.data[dim.name].iloc[0])
else:
return float
ds = dataset.clone(arr, datatype=cls.subtypes, vdims=[])
return ds.interface.dimension_type(ds, dim)

@classmethod
def isscalar(cls, dataset, dim, per_geom=False):
Expand Down

0 comments on commit 9c32fbe

Please sign in to comment.