1

I am trying to load in a shapefile with the use of geopandas. I have read the file in, but when I go to add the layer to the ipyleaflet map, an error comes up that says 'GeoDataFrame' object has no attribute 'model_id'. I have tried many files and it just will not read with the geodataframe.

from ipyleaflet import Map, basemaps
fire_was = gpd.read_file('fire_wa.shp')
#add map

center = [47.409824923593575,-120.43401014843751]zoom = 7
m = Map(basemap=basemaps.OpenStreetMap.Mapnik, center=center, zoom=zoom)

m.add_layer(fire_was)

m

Any ideas?

coues
  • 31
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 10 '21 at 02:40

1 Answers1

2

I figured it out. The example I had seen did not show the below but checked more of the documentation of ipyleaflet. You must use GeoData to load the geodataframe.

from ipyleaflet  import Map, GeoData, basemaps, LayersControl

fire_was = gpd.read_file('fire_wa.shp') firewa = GeoData(geo_dataframe = fire_was)

m = Map(center =(47.409824923593575,-120.43401014843751), zoom =7,basemap= basemaps.Esri.WorldTopoMap)

m.add_layer(firewa)

m

coues
  • 31
  • 2