当我试图绘制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,但我不确定如何做到这一点相关问题 更多 >
编程相关推荐