When I try to plot Postgis Linestring, thanks to gv.Path()
or hvplot(geo=True)
, I have this error : 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
When I try the visualization :
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
When I do hvplot(geo=False)
it works but I would like to have a base map and benefit from all the Geoview's options.
Would someone have an idea ?
GeoViews needs to know which of your data columns or dimensions should be used for latitude and longitude. I think you can either rename the data columns to "Longitude" and "Latitude", or you can tell GeoViews what the dimensions are named with something like gv.Path(data, ['lon','lat'])
. There's probably a way to supply the names explicitly to hvPlot as well, but I'm not sure how to do that.