How to plot gdf to hvplot

Hi all,

how we can plot gdf file into hvplot if example gdf file is like this:

i try this one:

import geopandas as gpd
import hvplot.pandas


gdf = gpd.read_file('https://github.com/opengeos/leafmap/raw/master/examples/data/cable_geo.geojson')

# Plot the GeoDataFrame using hvplot
a=gdf.hvplot(geo=True, line_color='blue', line_width=3,  frame_width=800, frame_height=600)
a

but not plot showed only output : :Path [Longitude,Latitude]

is that possible to plot from the geometry column of the gpd file. kindly please advise

thanks

Maybe import hvplot.geopandas

thanks @ahuang11 but there is no module for that

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[25], line 3
      1 import geopandas as gpd
      2 import hvplot.pandas
----> 3 import hvplot.geopandas
      6 gdf = gpd.read_file('https://github.com/opengeos/leafmap/raw/master/examples/data/cable_geo.geojson')
      8 # Plot the GeoDataFrame using hvplot

ModuleNotFoundError: No module named 'hvplot.geopandas'

Do you have geopandas installed / geoviews?

Hi @ahuang11 yes I have both geopandas (version 0.12.1) and geoviews(version 1.10.1) installed however the error is coming from hvplot which don’t have module for geopandas? my hvplot version 0.9.0

Hi @rh1, I can see the paths without any issue.

How are you running this code? In a notebook? Please give as much information as possible about your system, your python environment and what it contains.

thanks @maximlt , I try again in my jupyter lab and reset it, now it showing the map as per your image

thanks alot

1 Like

Hi @maximlt @ahuang11 , I just look again the file that I put as source for gpd which giving me no result ie only display this one when run in notebook

Path [Longitude,Latitude]

I notice that my geometry gpd is not in lat,lon. is it possible for hvplot to plot path which not in lat,lon for ie still in UTMX, UTMY, or probably how the work around to enable it (convert geometry column to lat,lon? but I don’t know how to convert that path into lat,lon. Kindly please advise.

thanks