gee-community/geemap

Error in opening shapefile in colab

NILICK opened this issue · 1 comments

NILICK commented

A few months ago I ran successfully the below code with geemap in colab, but today when I wanted to run it again it return an error. Is anything changed in geemap library !!? How can I do it again?

Map = geemap.Map(center=()
zagros_shp = 'zagros_south.shp'
aoi = geemap.shp_to_ee(zagros_shp)
Map.addLayer(aoi, {}, 'zagros')
Map

Error:

No module named 'shapefile'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-6-1e42def116c6>](https://localhost:8080/#) in <cell line: 4>()
      2 zagros_shp = '../zagros/zagros_south.shp'
      3 aoi = geemap.shp_to_ee(zagros_shp)
----> 4 Map.addLayer(aoi, {}, 'zagros')
      5 Map

[/usr/local/lib/python3.10/dist-packages/geemap/geemap.py](https://localhost:8080/#) in add_ee_layer(self, ee_object, vis_params, name, shown, opacity)
   1442         ):
   1443             err_str = "\n\nThe image argument in 'addLayer' function must be an instance of one of ee.Image, ee.Geometry, ee.Feature or ee.FeatureCollection."
-> 1444             raise AttributeError(err_str)
   1445 
   1446         if (

AttributeError: 

The image argument in 'addLayer' function must be an instance of one of ee.Image, ee.Geometry, ee.Feature or ee.FeatureCollection.

my shapefile:

https://drive.google.com/file/d/1Qm6IJC7uWGr1KnmVzg_fivVWjjqFzeqI/view?usp=sharing, https://drive.google.com/file/d/1SP9L95Uu729-lBfQKn2P0-Altap3lx4k/view?usp=sharing, https://drive.google.com/file/d/1tumdvyf7gCGMwVOK-MZ3mGVAjjqds265/view?usp=sharing, https://drive.google.com/file/d/1yY-iLkQBuDxhcWD40yckyY7saIAjfPAa/view?usp=sharing

giswqs commented

pyshp has been changed to an optional dependency. Please install it using pip install pyshp