Geoviews error : "Supplied data does not contain specified dimensions"

Geoviews error : "Supplied data does not contain specified dimensions"

当我尝试绘制 Postgis Linestring 时,由于 gv.Path()hvplot(geo=True),我遇到了这个错误:Supplied data does not contain specified dimensions, the following dimensions were not found: ['Longitude', 'Latitude'].

sqla="Select Geography(ST_transform(traja,4326)) as traja, namea,nameb,mmsia,mmsib,p_dist,cpa_id from filtered where nm_a is not null and geometrytype(traja)='LINESTRING' limit 10"
gdf=gpd.read_postgis(sqla,con,geom_col='traja')
gdf.head()

type(gdf['traja'][0])
----------------
shapely.geometry.linestring.LineString

当我尝试可视化时:

gdf.hvplot(geo=True)
----------------
DataError: Supplied data does not contain specified dimensions, the following dimensions were not found: ['Longitude', 'Latitude']

PandasInterface expects tabular data, for more information on supported datatypes see http://holoviews.org/user_guide/Tabular_Datasets.html

当我执行 hvplot(geo=False) 时它可以工作,但我想要一个底图并从 Geoview 的所有选项中受益。 有人会有想法吗?

GeoViews 需要知道哪些数据列或维度应该用于纬度和经度。我认为您可以将数据列重命名为“经度”和“纬度”,或者您可以告诉 GeoViews 维度的名称是什么,例如 gv.Path(data, ['lon','lat'])。可能还有一种方法可以显式地向 hvPlot 提供名称,但我不确定该怎么做。