多亏了gv.Path()或hvplot(geo=True),当我尝试绘制Postgis Linestring时,我遇到了这个错误: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的所有选项中受益。有人会有个主意吗?
发布于 2021-10-14 19:15:33
GeoViews需要知道哪些数据列或维度应该用于纬度和经度。我认为您可以将数据列重命名为“经度”和“纬度”,也可以使用类似gv.Path(data, ['lon','lat'])的名称告诉GeoViews维度的名称。可能也有一种方法可以显式地将名称提供给hvPlot,但我不确定如何做到这一点。
https://stackoverflow.com/questions/69571957
复制相似问题