Search code examples
pythongisgeopandas

'GeoDataFrame' object has no attribute 'explore'


I wanted to try Geopanda's interactive visualization, and the function .explore() unfortunatly I have this error message : 'GeoDataFrame' object has no attribute 'explore' Which is quite weird as GeoDataFrame should be compatible with explore (https://geopandas.org/docs/reference/api/geopandas.GeoDataFrame.explore.html). I'm using Geopandas v. 0.9.0. and my code is :

import folium
import pandas as pd
import geopandas as gpd

from sqlalchemy import create_engine
engine = create_engine('postgresql://docker:[email protected]:25432/mobilitydb')
query=gpd.read_postgis("Select traja,mmsia from filtered where nm_a is not null and geometrytype(traja)='LINESTRING'",engine,geom_col='traja')
plot=query.explore()

does anyone as an idea ?


Solution

  • I think the issue is with the version of Geopandas you are using. I had a similar issue. I had originally installed geopandas from the apt repository(I am using Kali Linux). I uninstalled geopandas, and then installed it using pip3 install geopandas folium matplotlib mapclassify. That seemed to work for me. The version pip installed was geopandas-0.10.1