0

当我尝试绘制 Postgis Linestring 时,感谢gv.Path()or 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()

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 的所有选项中受益。有人会有想法吗?

4

1 回答 1

0

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

于 2021-10-14T19:15:32.997 回答